aboutsummaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>1999-09-08 08:19:52 +0000
committerJeff Law <law@gcc.gnu.org>1999-09-08 02:19:52 -0600
commitb10647f1b2068be06900f34b0ca8286ae56927f2 (patch)
treea06393716745f47e90a677ca5064aea4212fe102 /libiberty
parent898458348547ead27183dbecb75a3bf6713d0074 (diff)
downloadgcc-b10647f1b2068be06900f34b0ca8286ae56927f2.zip
gcc-b10647f1b2068be06900f34b0ca8286ae56927f2.tar.gz
gcc-b10647f1b2068be06900f34b0ca8286ae56927f2.tar.bz2
xmemdup.c: New xmemdup function.
* xmemdup.c: New xmemdup function. * Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co]. From-SVN: r29199
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/ChangeLog5
-rw-r--r--libiberty/Makefile.in5
-rw-r--r--libiberty/makefile.vms2
-rw-r--r--libiberty/vmsbuild.com2
-rw-r--r--libiberty/xmemdup.c20
5 files changed, 30 insertions, 4 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog
index 317e9da..77f42ef 100644
--- a/libiberty/ChangeLog
+++ b/libiberty/ChangeLog
@@ -1,3 +1,8 @@
+1999-09-07 Jeff Garzik <jgarzik@pobox.com>
+
+ * xmemdup.c: New xmemdup function.
+ * Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co].
+
Tue Sep 7 23:32:18 1999 Linas Vepstas <linas@linas.org>
* config.table: Add openedition target.
diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in
index 001a714..adaf8a6 100644
--- a/libiberty/Makefile.in
+++ b/libiberty/Makefile.in
@@ -129,14 +129,14 @@ CFILES = asprintf.c alloca.c argv.c atexit.c basename.c bcmp.c bcopy.c \
spaces.c splay-tree.c strcasecmp.c strncasecmp.c strchr.c strdup.c \
strerror.c strrchr.c strsignal.c strstr.c strtod.c strtol.c strtoul.c \
tmpnam.c vasprintf.c vfork.c vfprintf.c vprintf.c vsprintf.c \
- waitpid.c xatexit.c xexit.c xmalloc.c xstrdup.c xstrerror.c
+ waitpid.c xatexit.c xexit.c xmalloc.c xmemdup.c xstrdup.c xstrerror.c
# These are always included in the library.
REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \
fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o getruntime.o hex.o \
floatformat.o objalloc.o obstack.o pexecute.o spaces.o \
splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.o \
- xstrdup.o xstrerror.o
+ xmemdup.o xstrdup.o xstrerror.o
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
rm -f $(TARGETLIB)
@@ -270,5 +270,6 @@ strsignal.o: config.h $(INCDIR)/libiberty.h
xatexit.o: $(INCDIR)/libiberty.h
xexit.o: $(INCDIR)/libiberty.h
xmalloc.o: $(INCDIR)/libiberty.h
+xmemdup.o: config.h $(INCDIR)/libiberty.h
xstrdup.o: config.h $(INCDIR)/libiberty.h
xstrerror.o: config.h $(INCDIR)/libiberty.h
diff --git a/libiberty/makefile.vms b/libiberty/makefile.vms
index b61b512..6a7dd45 100644
--- a/libiberty/makefile.vms
+++ b/libiberty/makefile.vms
@@ -10,7 +10,7 @@
OBJS=bcopy.obj,bcmp.obj,getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\
getopt1.obj,cplus-dem.obj,strncasecmp.obj,strcasecmp.obj,strdup.obj,\
concat.obj,getruntime.obj,getpagesize.obj,alloca.obj,xstrerror.obj,\
- xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj
+ xmemdup.obj,xstrdup.obj,xatexit.obj,choose-temp.obj,fnmatch.obj,objalloc.obj
ifeq ($(CC),gcc)
CFLAGS=/include=([],[-.include])
diff --git a/libiberty/vmsbuild.com b/libiberty/vmsbuild.com
index 4fede38..497ea89 100644
--- a/libiberty/vmsbuild.com
+++ b/libiberty/vmsbuild.com
@@ -15,7 +15,7 @@ $! manually copied from Makefile.in
$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "-
+ "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "-
+ "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.o "-
- + "xatexit.o xexit.o xmalloc.o xstrdup.o xstrerror.o"
+ + "xatexit.o xexit.o xmalloc.o xmemdup.o xstrdup.o xstrerror.o"
$! anything not caught by link+search of dummy.* should be added here
$ EXTRA_OFILES = ""
$!
diff --git a/libiberty/xmemdup.c b/libiberty/xmemdup.c
new file mode 100644
index 0000000..8e82469
--- /dev/null
+++ b/libiberty/xmemdup.c
@@ -0,0 +1,20 @@
+/* xmemdup.c -- Duplicate a memory buffer, using xcalloc.
+ This trivial function is in the public domain.
+ Jeff Garzik, September 1999. */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "ansidecl.h"
+#include "libiberty.h"
+
+PTR
+xmemdup (input, copy_size, alloc_size)
+ const PTR input;
+ size_t copy_size;
+ size_t alloc_size;
+{
+ PTR output = xcalloc (1, alloc_size);
+ memcpy (output, input, copy_size);
+ return output;
+}