From 8f3934261ad4a7f486d2fffa9c961d7535675d8f Mon Sep 17 00:00:00 2001 From: tmm1 Date: Mon, 11 Nov 2013 09:39:13 +0000 Subject: [PATCH] * internal.h: move common string/hash flags to include file. * ext/objspace/objspace_dump.c: remove flags shared above. * hash.c: ditto. * string.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43647 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ ext/objspace/objspace_dump.c | 14 -------------- hash.c | 3 --- internal.h | 12 ++++++++++++ string.c | 11 ----------- 5 files changed, 19 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5630026c7..ba5f5010fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Mon Nov 11 18:31:12 2013 Aman Gupta + + * internal.h: move common string/hash flags to include file. + * ext/objspace/objspace_dump.c: remove flags shared above. + * hash.c: ditto. + * string.c: ditto. + Mon Nov 11 04:36:14 2013 Eric Hodel * lib/rubygems/specification.rb: Include 2.2.0.preview.2 when checking diff --git a/ext/objspace/objspace_dump.c b/ext/objspace/objspace_dump.c index 7ee5e7c11a..290a4434b4 100644 --- a/ext/objspace/objspace_dump.c +++ b/ext/objspace/objspace_dump.c @@ -21,20 +21,6 @@ #include "vm_core.h" #include "objspace.h" -/* from string.c */ -#define STR_NOEMBED FL_USER1 -#define STR_SHARED FL_USER2 /* = ELTS_SHARED */ -#define STR_ASSOC FL_USER3 -#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED) -#define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC) -#define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC) -#define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC)) -#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED)) -#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) -#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) -/* from hash.c */ -#define HASH_PROC_DEFAULT FL_USER2 - static VALUE sym_output, sym_stdout, sym_string, sym_file; struct dump_config { diff --git a/hash.c b/hash.c index 83d179964f..4a0838c04d 100644 --- a/hash.c +++ b/hash.c @@ -29,9 +29,6 @@ static VALUE rb_hash_s_try_convert(VALUE, VALUE); -#define HASH_DELETED FL_USER1 -#define HASH_PROC_DEFAULT FL_USER2 - /* * Hash WB strategy: * 1. Check mutate st_* functions diff --git a/internal.h b/internal.h index e7ecbbeda4..508e77d02e 100644 --- a/internal.h +++ b/internal.h @@ -439,6 +439,8 @@ struct st_table *rb_hash_tbl_raw(VALUE hash); #define RHASH_TBL_RAW(h) rb_hash_tbl_raw(h) VALUE rb_hash_keys(VALUE hash); VALUE rb_hash_values(VALUE hash); +#define HASH_DELETED FL_USER1 +#define HASH_PROC_DEFAULT FL_USER2 /* inits.c */ void rb_call_inits(void); @@ -675,6 +677,16 @@ VALUE rb_str_locktmp_ensure(VALUE str, VALUE (*func)(VALUE), VALUE arg); #ifdef RUBY_ENCODING_H VALUE rb_external_str_with_enc(VALUE str, rb_encoding *eenc); #endif +#define STR_NOEMBED FL_USER1 +#define STR_SHARED FL_USER2 /* = ELTS_SHARED */ +#define STR_ASSOC FL_USER3 +#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED) +#define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC) +#define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC) +#define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC)) +#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED)) +#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) +#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) /* struct.c */ VALUE rb_struct_init_copy(VALUE copy, VALUE s); diff --git a/string.c b/string.c index ca73d41f98..310140d99d 100644 --- a/string.c +++ b/string.c @@ -49,13 +49,6 @@ VALUE rb_cSymbol; #define RUBY_MAX_CHAR_LEN 16 #define STR_TMPLOCK FL_USER7 -#define STR_NOEMBED FL_USER1 -#define STR_SHARED FL_USER2 /* = ELTS_SHARED */ -#define STR_ASSOC FL_USER3 -#define STR_SHARED_P(s) FL_ALL((s), STR_NOEMBED|ELTS_SHARED) -#define STR_ASSOC_P(s) FL_ALL((s), STR_NOEMBED|STR_ASSOC) -#define STR_NOCAPA (STR_NOEMBED|ELTS_SHARED|STR_ASSOC) -#define STR_NOCAPA_P(s) (FL_TEST((s),STR_NOEMBED) && FL_ANY((s),ELTS_SHARED|STR_ASSOC)) #define STR_UNSET_NOCAPA(s) do {\ if (FL_TEST((s),STR_NOEMBED)) FL_UNSET((s),(ELTS_SHARED|STR_ASSOC));\ } while (0) @@ -65,7 +58,6 @@ VALUE rb_cSymbol; STR_SET_EMBED_LEN((str), 0);\ } while (0) #define STR_SET_EMBED(str) FL_UNSET((str), STR_NOEMBED) -#define STR_EMBED_P(str) (!FL_TEST((str), STR_NOEMBED)) #define STR_SET_EMBED_LEN(str, n) do { \ long tmp_n = (n);\ RBASIC(str)->flags &= ~RSTRING_EMBED_LEN_MASK;\ @@ -129,9 +121,6 @@ VALUE rb_cSymbol; #define STR_HEAP_PTR(str) (RSTRING(str)->as.heap.ptr) #define STR_HEAP_SIZE(str) (RSTRING(str)->as.heap.aux.capa + TERM_LEN(str)) -#define is_ascii_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_7BIT) -#define is_broken_string(str) (rb_enc_str_coderange(str) == ENC_CODERANGE_BROKEN) - #define STR_ENC_GET(str) rb_enc_from_index(ENCODING_GET(str)) static int fstring_cmp(VALUE a, VALUE b);