diff options
Diffstat (limited to 'gdb/guile/scm-utils.c')
-rw-r--r-- | gdb/guile/scm-utils.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/guile/scm-utils.c b/gdb/guile/scm-utils.c index 9e9901d..918a51b 100644 --- a/gdb/guile/scm-utils.c +++ b/gdb/guile/scm-utils.c @@ -583,3 +583,15 @@ gdbscm_is_procedure (SCM proc) { return gdbscm_is_true (scm_procedure_p (proc)); } + +/* Same as xstrdup, but the string is allocated on the GC heap. */ + +char * +gdbscm_gc_xstrdup (const char *str) +{ + size_t len = strlen (str); + char *result = scm_gc_malloc_pointerless (len + 1, "gdbscm_gc_xstrdup"); + + strcpy (result, str); + return result; +} |