diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2003-05-08 05:36:52 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2003-05-08 05:36:52 +0000 |
commit | b1ca941db1b833d9197edd3f2a2ecd1633bc1d81 (patch) | |
tree | 544d1f8821bca7e4b0a7cbba9aca8a71efabb8a3 /gnu/lib/libreadline/savestring.c | |
parent | 762627a92975f83878f76ab532715c2a26899234 (diff) |
strings
ok tedu@, art@
Diffstat (limited to 'gnu/lib/libreadline/savestring.c')
-rw-r--r-- | gnu/lib/libreadline/savestring.c | 17 |
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)); } |