aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdb_obstack.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-07-13 12:03:07 -0600
committerTom Tromey <tom@tromey.com>2019-08-06 20:08:48 -0600
commitf25102f7b100337923d2c81ecc12a64d428e98fe (patch)
tree42b40c62e5761a94b63167ea044f18652d2974ac /gdb/gdb_obstack.h
parent021887d88a040cf39f3afbd7da10bbe3ff1ad6c3 (diff)
downloadgdb-f25102f7b100337923d2c81ecc12a64d428e98fe.zip
gdb-f25102f7b100337923d2c81ecc12a64d428e98fe.tar.gz
gdb-f25102f7b100337923d2c81ecc12a64d428e98fe.tar.bz2
Make obstack_strdup inline
This changes obstack_strdup to be an inline function. This seems better to me, considering how small it is; but also it follows what the code did before the previous patch. gdb/ChangeLog 2019-08-06 Tom Tromey <tom@tromey.com> * gdb_obstack.h (obstack_strdup): Define. * gdb_obstack.c (obstack_strdup): Don't define.
Diffstat (limited to 'gdb/gdb_obstack.h')
-rw-r--r--gdb/gdb_obstack.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/gdb_obstack.h b/gdb/gdb_obstack.h
index 143fcf7..829e2f9 100644
--- a/gdb/gdb_obstack.h
+++ b/gdb/gdb_obstack.h
@@ -89,7 +89,11 @@ extern char *obconcat (struct obstack *obstackp, ...) ATTRIBUTE_SENTINEL;
/* Duplicate STRING, returning an equivalent string that's allocated on the
obstack OBSTACKP. */
-extern char *obstack_strdup (struct obstack *obstackp, const char *string);
+static inline char *
+obstack_strdup (struct obstack *obstackp, const char *string)
+{
+ return (char *) obstack_copy0 (obstackp, string, strlen (string));
+}
/* An obstack that frees itself on scope exit. */
struct auto_obstack : obstack