aboutsummaryrefslogtreecommitdiff
path: root/gcc/stringpool.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@gcc.gnu.org>2017-06-30 17:00:46 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2017-06-30 17:00:46 +0000
commit618400bc14b5c52a450e91d59632d5b08ae1a325 (patch)
treead3b95702069a60d64947311946c8789498fb972 /gcc/stringpool.c
parent84682fd249b3f86e88e79b47527b168c873dc5f0 (diff)
downloadgcc-618400bc14b5c52a450e91d59632d5b08ae1a325.zip
gcc-618400bc14b5c52a450e91d59632d5b08ae1a325.tar.gz
gcc-618400bc14b5c52a450e91d59632d5b08ae1a325.tar.bz2
ggc.h (empty_string): Delete.
* ggc.h (empty_string): Delete. * cfgexpand.c (expand_asm_stmt): Use plain "". * optabs.c (expand_asm_memory_barrier): Likewise. * stringpool.c (empty_string): Delete. (digit_vector, digit_string): Delete. (ggc_alloc_string): Use plain "", don't optimize single digit strings. Use ggc_alloc_atomic. From-SVN: r249851
Diffstat (limited to 'gcc/stringpool.c')
-rw-r--r--gcc/stringpool.c23
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;
}