mirror of git://gcc.gnu.org/git/gcc.git
xmemdup.c: New xmemdup function.
* xmemdup.c: New xmemdup function. * Makefile.in, makefile.vms, vmsbuild.com: Use xmemdup.[co]. From-SVN: r29199
This commit is contained in:
parent
8984583485
commit
b10647f1b2
|
@ -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>
|
Tue Sep 7 23:32:18 1999 Linas Vepstas <linas@linas.org>
|
||||||
|
|
||||||
* config.table: Add openedition target.
|
* config.table: Add openedition target.
|
||||||
|
|
|
@ -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 \
|
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 \
|
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 \
|
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.
|
# These are always included in the library.
|
||||||
REQUIRED_OFILES = argv.o choose-temp.o concat.o cplus-dem.o \
|
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 \
|
fdmatch.o fnmatch.o getopt.o getopt1.o getpwd.o getruntime.o hex.o \
|
||||||
floatformat.o objalloc.o obstack.o pexecute.o spaces.o \
|
floatformat.o objalloc.o obstack.o pexecute.o spaces.o \
|
||||||
splay-tree.o strerror.o strsignal.o xatexit.o xexit.o xmalloc.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)
|
$(TARGETLIB): $(REQUIRED_OFILES) $(EXTRA_OFILES) $(LIBOBJS) $(ALLOCA)
|
||||||
rm -f $(TARGETLIB)
|
rm -f $(TARGETLIB)
|
||||||
|
@ -270,5 +270,6 @@ strsignal.o: config.h $(INCDIR)/libiberty.h
|
||||||
xatexit.o: $(INCDIR)/libiberty.h
|
xatexit.o: $(INCDIR)/libiberty.h
|
||||||
xexit.o: $(INCDIR)/libiberty.h
|
xexit.o: $(INCDIR)/libiberty.h
|
||||||
xmalloc.o: $(INCDIR)/libiberty.h
|
xmalloc.o: $(INCDIR)/libiberty.h
|
||||||
|
xmemdup.o: config.h $(INCDIR)/libiberty.h
|
||||||
xstrdup.o: config.h $(INCDIR)/libiberty.h
|
xstrdup.o: config.h $(INCDIR)/libiberty.h
|
||||||
xstrerror.o: config.h $(INCDIR)/libiberty.h
|
xstrerror.o: config.h $(INCDIR)/libiberty.h
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
OBJS=bcopy.obj,bcmp.obj,getopt.obj,obstack.obj,xexit.obj,xmalloc.obj,hex.obj,\
|
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,\
|
getopt1.obj,cplus-dem.obj,strncasecmp.obj,strcasecmp.obj,strdup.obj,\
|
||||||
concat.obj,getruntime.obj,getpagesize.obj,alloca.obj,xstrerror.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)
|
ifeq ($(CC),gcc)
|
||||||
CFLAGS=/include=([],[-.include])
|
CFLAGS=/include=([],[-.include])
|
||||||
|
|
|
@ -15,7 +15,7 @@ $! manually copied from Makefile.in
|
||||||
$ REQUIRED_OFILES = "argv.o basename.o choose-temp.o concat.o cplus-dem.o "-
|
$ 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 "-
|
+ "fdmatch.o fnmatch.o getopt.o getopt1.o getruntime.o hex.o "-
|
||||||
+ "floatformat.o objalloc.o obstack.o spaces.o strerror.o strsignal.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
|
$! anything not caught by link+search of dummy.* should be added here
|
||||||
$ EXTRA_OFILES = ""
|
$ EXTRA_OFILES = ""
|
||||||
$!
|
$!
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
Loading…
Reference in New Issue