diff options
Diffstat (limited to 'gcc/stringpool.c')
-rw-r--r-- | gcc/stringpool.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/gcc/stringpool.c b/gcc/stringpool.c index 6893275..7aa4e86 100644 --- a/gcc/stringpool.c +++ b/gcc/stringpool.c @@ -30,18 +30,6 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" -/* The "" allocated string. */ -const char empty_string[] = ""; - -/* Character strings, each containing a single decimal digit. - Written this way to save space. */ -static const char digit_vector[] = { - '0', 0, '1', 0, '2', 0, '3', 0, '4', 0, - '5', 0, '6', 0, '7', 0, '8', 0, '9', 0 -}; - -#define digit_string(d) (digit_vector + ((d) * 2)) - struct ht *ident_hash; static hashnode alloc_node (cpp_hash_table *); @@ -82,19 +70,16 @@ alloc_node (cpp_hash_table *table ATTRIBUTE_UNUSED) const char * ggc_alloc_string (const char *contents, int length MEM_STAT_DECL) { - char *result; - if (length == -1) length = strlen (contents); - if (length == 0) - return empty_string; - if (length == 1 && ISDIGIT (contents[0])) - return digit_string (contents[0] - '0'); + if (!length) + return ""; - result = (char *) ggc_internal_cleared_alloc (length + 1 PASS_MEM_STAT); + char *result = (char *) ggc_alloc_atomic (length + 1); memcpy (result, contents, length); result[length] = '\0'; + return (const char *) result; } |