1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use shared flags of the type

The ELTS_SHARED flag is generic, so we should prefer to use the flags
specific of the type (STR_SHARED for strings and RARRAY_SHARED_FLAG
for arrays).
This commit is contained in:
Peter Zhu 2022-11-02 11:03:21 -04:00
parent 875b7b3361
commit 4a8cd9e8bc
2 changed files with 3 additions and 2 deletions

View file

@ -14,6 +14,7 @@
#include "gc.h" #include "gc.h"
#include "internal.h" #include "internal.h"
#include "internal/array.h"
#include "internal/hash.h" #include "internal/hash.h"
#include "internal/string.h" #include "internal/string.h"
#include "internal/sanitizers.h" #include "internal/sanitizers.h"
@ -456,7 +457,7 @@ dump_object(VALUE obj, struct dump_config *dc)
case T_ARRAY: case T_ARRAY:
dump_append(dc, ", \"length\":"); dump_append(dc, ", \"length\":");
dump_append_ld(dc, RARRAY_LEN(obj)); dump_append_ld(dc, RARRAY_LEN(obj));
if (RARRAY_LEN(obj) > 0 && FL_TEST(obj, ELTS_SHARED)) if (RARRAY_LEN(obj) > 0 && FL_TEST(obj, RARRAY_SHARED_FLAG))
dump_append(dc, ", \"shared\":true"); dump_append(dc, ", \"shared\":true");
if (FL_TEST(obj, RARRAY_EMBED_FLAG)) if (FL_TEST(obj, RARRAY_EMBED_FLAG))
dump_append(dc, ", \"embedded\":true"); dump_append(dc, ", \"embedded\":true");

View file

@ -106,7 +106,7 @@ STR_EMBED_P(VALUE str)
static inline bool static inline bool
STR_SHARED_P(VALUE str) STR_SHARED_P(VALUE str)
{ {
return FL_ALL_RAW(str, STR_NOEMBED | ELTS_SHARED); return FL_ALL_RAW(str, STR_NOEMBED | STR_SHARED);
} }
static inline bool static inline bool