summaryrefslogtreecommitdiff
path: root/gcc/ggc-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r--gcc/ggc-common.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 74b554702f7..fc8fb653790 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -580,7 +580,7 @@ ggc_alloc_string (contents, length)
length = strlen (contents);
}
- string = (char *) ggc_alloc_obj (length + 1, 0);
+ string = (char *) ggc_alloc (length + 1);
if (contents != NULL)
memcpy (string, contents, length);
string[length] = 0;
@@ -588,6 +588,16 @@ ggc_alloc_string (contents, length)
return string;
}
+/* Allocate a block of memory, then clear it. */
+void *
+ggc_alloc_cleared (size)
+ size_t size;
+{
+ void *buf = ggc_alloc (size);
+ memset (buf, 0, size);
+ return buf;
+}
+
/* Print statistics that are independent of the collector in use. */
void