diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-13 17:09:18 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-10-13 17:09:18 +0000 |
commit | 7166161172b816ed738a47c9a7d50f0fbd763c6d (patch) | |
tree | 618d754ad605b42a6cdca53980a97a361d152aa9 /gcc/ggc-common.c | |
parent | 3459bb21384e65c9e01d24a56fc6f1f554293671 (diff) | |
download | gcc-7166161172b816ed738a47c9a7d50f0fbd763c6d.tar.gz |
Simplified GC interface and other goodies.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29946 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ggc-common.c')
-rw-r--r-- | gcc/ggc-common.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 6df622e8e04..3aa0d998ceb 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -268,21 +268,18 @@ ggc_mark_rtx_children (r) ggc_mark_rtvec (XVEC (r, i)); break; case 'S': case 's': - ggc_mark_string_if_gcable (XSTR (r, i)); + ggc_mark_if_gcable (XSTR (r, i)); break; } } } void -ggc_mark_rtvec (v) +ggc_mark_rtvec_children (v) rtvec v; { int i; - if (v == NULL || ggc_set_mark_rtvec (v)) - return; - i = GET_NUM_ELEM (v); while (--i >= 0) ggc_mark_rtx (RTVEC_ELT (v, i)); @@ -451,3 +448,26 @@ ggc_mark_tree_hash_table (ht) hash_traverse (ht, ggc_mark_tree_hash_table_entry, /*info=*/0); } +/* Allocation wrappers. */ + +char * +ggc_alloc_string (contents, length) + const char *contents; + int length; +{ + char *string; + + if (length < 0) + { + if (contents == NULL) + return NULL; + length = strlen (contents); + } + + string = (char *) ggc_alloc_obj (length + 1, 0); + if (contents != NULL) + memcpy (string, contents, length); + string[length] = 0; + + return string; +} |