mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Introduce mrb_ssize type for buffer size on memory; ref #4483
Previously, `mrb_int` was used as the type that represents the buffer size on memory, but the sizes of `RString` and `RArray` exceed 6 words when `MRB_INT64` is enabled on 32-bit CPU. I don't think it is necessary to be able to represent the buffer size on memory that exceeds the virtual address space. Therefore, for this purpose, introduce `mrb_ssize` which doesn't exceed the sizes of `mrb_int` and pointer. I think all `mrb_int` used for this purpose should be changed to `mrb_ssize`, but currently only the members of the structures (`RString`, `mrb_shared_string`, `RArray` and `mrb_shared_array`) are changed.
This commit is contained in:
@@ -23,9 +23,9 @@ struct RString {
|
||||
MRB_OBJECT_HEADER;
|
||||
union {
|
||||
struct {
|
||||
mrb_int len;
|
||||
mrb_ssize len;
|
||||
union {
|
||||
mrb_int capa;
|
||||
mrb_ssize capa;
|
||||
struct mrb_shared_string *shared;
|
||||
struct RString *fshared;
|
||||
} aux;
|
||||
@@ -54,7 +54,7 @@ struct RStringEmbed {
|
||||
RSTR_SET_EMBED_LEN((s),(n));\
|
||||
}\
|
||||
else {\
|
||||
(s)->as.heap.len = (mrb_int)(n);\
|
||||
(s)->as.heap.len = (mrb_ssize)(n);\
|
||||
}\
|
||||
} while (0)
|
||||
#define RSTR_EMBED_PTR(s) (((struct RStringEmbed*)(s))->ary)
|
||||
|
||||
Reference in New Issue
Block a user