summaryrefslogtreecommitdiff
path: root/gnu/lib/libreadline/savestring.c
diff options
context:
space:
mode:
authorBob Beck <beck@cvs.openbsd.org>2003-05-08 05:36:52 +0000
committerBob Beck <beck@cvs.openbsd.org>2003-05-08 05:36:52 +0000
commitb1ca941db1b833d9197edd3f2a2ecd1633bc1d81 (patch)
tree544d1f8821bca7e4b0a7cbba9aca8a71efabb8a3 /gnu/lib/libreadline/savestring.c
parent762627a92975f83878f76ab532715c2a26899234 (diff)
strings
ok tedu@, art@
Diffstat (limited to 'gnu/lib/libreadline/savestring.c')
-rw-r--r--gnu/lib/libreadline/savestring.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gnu/lib/libreadline/savestring.c b/gnu/lib/libreadline/savestring.c
index 0916ab8b0a4..679adeb86e1 100644
--- a/gnu/lib/libreadline/savestring.c
+++ b/gnu/lib/libreadline/savestring.c
@@ -22,14 +22,25 @@
#include <string.h>
-extern char *strcpy ();
-extern char *xmalloc ();
+extern char * xmalloc();
+extern void memory_error_and_abort(char *);
/* Backwards compatibility, now that savestring has been removed from
all `public' readline header files. */
+
+char *
+xstrdup(char *s)
+{
+ char * cp;
+ cp = strdup(s);
+ if (cp == NULL)
+ memory_error_and_abort("savestring");
+ return(cp);
+}
+
char *
savestring (s)
char *s;
{
- return ((char *)strcpy (xmalloc (1 + (int)strlen (s)), (s)));
+ return(xstrdup(s));
}