Method: Snow::Memory#set_string
- Defined in:
- ext/snow-data/snow-data.c
#set_string(offset, value, null_terminated = false) ⇒ Object
Copies the string value into the block at the offset supplied.
If null_terminated is true, it will always write a null-terminating character if it fits. This means that you need at least string.bytesize + 1 bytes available from the offset onwards to fully story a string, otherwise the string’s contents will be truncated to fit the null-terminating character.
If null_terminated is false, no null character is written and only the string bytes are copied to the block. If the full string does not fit, it will be truncated.
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 |
# File 'ext/snow-data/snow-data.c', line 1304
static VALUE sd_set_string(int argc, VALUE *argv, VALUE self)
{
VALUE sd_offset, sd_value, sd_null_terminated;
sd_check_null_block(self);
rb_check_frozen(self);
rb_scan_args(argc, argv, "21", &sd_offset, &sd_value, &sd_null_terminated);
return sd_set_string_nullterm(self, sd_offset, sd_value, !!RTEST(sd_null_terminated));
}
|