2000-06-15 H.J. Lu <hjl@gnu.org>
* dyn-string.c: Removed. Not needed with dyn-string.c in libiberty. * dyn-string.h: Likewise. * Makefile.am: Remove references to dyn-string.c and dyn-string.h. Rebuild dependency. * Makefile.in: Rebuild.
This commit is contained in:
parent
efbc5fba8f
commit
0724d64b8d
@ -1,3 +1,13 @@
|
|||||||
|
2000-06-15 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
|
* dyn-string.c: Removed. Not needed with dyn-string.c in
|
||||||
|
libiberty.
|
||||||
|
* dyn-string.h: Likewise.
|
||||||
|
|
||||||
|
* Makefile.am: Remove references to dyn-string.c and
|
||||||
|
dyn-string.h. Rebuild dependency.
|
||||||
|
* Makefile.in: Rebuild.
|
||||||
|
|
||||||
2000-06-15 H.J. Lu <hjl@gnu.org>
|
2000-06-15 H.J. Lu <hjl@gnu.org>
|
||||||
|
|
||||||
* binutils.texi: Put a warning on copying relocatable object
|
* binutils.texi: Put a warning on copying relocatable object
|
||||||
|
@ -77,7 +77,7 @@ MKDEP = gcc -MM
|
|||||||
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
||||||
|
|
||||||
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
||||||
windres.h winduni.h dyn-string.h
|
windres.h winduni.h
|
||||||
|
|
||||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \
|
|||||||
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
||||||
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
||||||
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
|
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
|
||||||
resres.c dyn-string.c dllwrap.c rename.c
|
resres.c dllwrap.c rename.c
|
||||||
|
|
||||||
GENERATED_CFILES = \
|
GENERATED_CFILES = \
|
||||||
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
|
underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \
|
||||||
@ -245,7 +245,7 @@ sysinfo.h: sysinfo.c
|
|||||||
|
|
||||||
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
||||||
|
|
||||||
dlltool_SOURCES = dlltool.c defparse.y deflex.l dyn-string.c $(BULIBS)
|
dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
|
||||||
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||||
|
|
||||||
dlltool.o:dlltool.c
|
dlltool.o:dlltool.c
|
||||||
@ -270,7 +270,7 @@ windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \
|
|||||||
winduni.c resres.c $(BULIBS)
|
winduni.c resres.c $(BULIBS)
|
||||||
windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||||
|
|
||||||
dllwrap_SOURCES = dllwrap.c dyn-string.c version.c
|
dllwrap_SOURCES = dllwrap.c version.c
|
||||||
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
||||||
|
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
|||||||
$(INCDIR)/libiberty.h debug.h
|
$(INCDIR)/libiberty.h debug.h
|
||||||
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||||
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h dyn-string.h \
|
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/dyn-string.h \
|
||||||
dlltool.h
|
dlltool.h
|
||||||
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||||
@ -488,11 +488,9 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
|||||||
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||||
dyn-string.o: dyn-string.c config.h $(INCDIR)/ansidecl.h \
|
|
||||||
dyn-string.h
|
|
||||||
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||||
$(INCDIR)/fopen-same.h dyn-string.h
|
$(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h
|
||||||
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||||
underscore.o: underscore.c
|
underscore.o: underscore.c
|
||||||
|
@ -178,7 +178,7 @@ MKDEP = gcc -MM
|
|||||||
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
INCLUDES = -D_GNU_SOURCE -I. -I$(srcdir) -I../bfd -I$(BFDDIR) -I$(INCDIR) @HDEFINES@ -I$(srcdir)/../intl -I../intl -DLOCALEDIR="\"$(prefix)/share/locale\""
|
||||||
|
|
||||||
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \
|
||||||
windres.h winduni.h dyn-string.h
|
windres.h winduni.h
|
||||||
|
|
||||||
|
|
||||||
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
|
||||||
@ -189,7 +189,7 @@ CFILES = addr2line.c ar.c arsup.c bucomm.c coffdump.c coffgrok.c debug.c \
|
|||||||
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \
|
||||||
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
stabs.c strings.c sysdump.c version.c wrstabs.c \
|
||||||
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
|
windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \
|
||||||
resres.c dyn-string.c dllwrap.c rename.c
|
resres.c dllwrap.c rename.c
|
||||||
|
|
||||||
|
|
||||||
GENERATED_CFILES = \
|
GENERATED_CFILES = \
|
||||||
@ -269,7 +269,7 @@ addr2line_SOURCES = addr2line.c $(BULIBS)
|
|||||||
|
|
||||||
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
srconv_SOURCES = srconv.c coffgrok.c $(BULIBS)
|
||||||
|
|
||||||
dlltool_SOURCES = dlltool.c defparse.y deflex.l dyn-string.c $(BULIBS)
|
dlltool_SOURCES = dlltool.c defparse.y deflex.l $(BULIBS)
|
||||||
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
dlltool_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||||
|
|
||||||
coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
|
coffdump_SOURCES = coffdump.c coffgrok.c $(BULIBS)
|
||||||
@ -283,7 +283,7 @@ windres_SOURCES = windres.c resrc.c rescoff.c resbin.c rcparse.y rclex.l \
|
|||||||
|
|
||||||
windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
windres_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS)
|
||||||
|
|
||||||
dllwrap_SOURCES = dllwrap.c dyn-string.c version.c
|
dllwrap_SOURCES = dllwrap.c version.c
|
||||||
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
dllwrap_LDADD = $(LIBIBERTY) $(INTLLIBS)
|
||||||
|
|
||||||
DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
|
DISTSTUFF = arparse.c arparse.h arlex.c nlmheader.c sysinfo.c sysinfo.h \
|
||||||
@ -333,15 +333,15 @@ coffdump_OBJECTS = coffdump.o coffgrok.o bucomm.o version.o filemode.o
|
|||||||
coffdump_LDADD = $(LDADD)
|
coffdump_LDADD = $(LDADD)
|
||||||
coffdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
coffdump_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
||||||
coffdump_LDFLAGS =
|
coffdump_LDFLAGS =
|
||||||
dlltool_OBJECTS = dlltool.o defparse.o deflex.o dyn-string.o bucomm.o \
|
dlltool_OBJECTS = dlltool.o defparse.o deflex.o bucomm.o version.o \
|
||||||
version.o filemode.o
|
filemode.o
|
||||||
dlltool_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
dlltool_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
||||||
dlltool_LDFLAGS =
|
dlltool_LDFLAGS =
|
||||||
windres_OBJECTS = windres.o resrc.o rescoff.o resbin.o rcparse.o \
|
windres_OBJECTS = windres.o resrc.o rescoff.o resbin.o rcparse.o \
|
||||||
rclex.o winduni.o resres.o bucomm.o version.o filemode.o
|
rclex.o winduni.o resres.o bucomm.o version.o filemode.o
|
||||||
windres_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
windres_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a
|
||||||
windres_LDFLAGS =
|
windres_LDFLAGS =
|
||||||
dllwrap_OBJECTS = dllwrap.o dyn-string.o version.o
|
dllwrap_OBJECTS = dllwrap.o version.o
|
||||||
dllwrap_DEPENDENCIES = ../libiberty/libiberty.a
|
dllwrap_DEPENDENCIES = ../libiberty/libiberty.a
|
||||||
dllwrap_LDFLAGS =
|
dllwrap_LDFLAGS =
|
||||||
size_OBJECTS = size.o bucomm.o version.o filemode.o
|
size_OBJECTS = size.o bucomm.o version.o filemode.o
|
||||||
@ -414,7 +414,7 @@ configure.in deflex.c defparse.c nlmheader.c rclex.c rcparse.c
|
|||||||
|
|
||||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
|
|
||||||
TAR = tar
|
TAR = gtar
|
||||||
GZIP_ENV = --best
|
GZIP_ENV = --best
|
||||||
SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES)
|
SOURCES = $(nlmconv_SOURCES) $(srconv_SOURCES) $(sysdump_SOURCES) $(coffdump_SOURCES) $(dlltool_SOURCES) $(windres_SOURCES) $(dllwrap_SOURCES) $(size_SOURCES) $(objdump_SOURCES) $(ar_SOURCES) $(strings_SOURCES) $(ranlib_SOURCES) $(objcopy_SOURCES) $(addr2line_SOURCES) $(readelf_SOURCES) $(nm_new_SOURCES) $(strip_new_SOURCES) $(cxxfilt_SOURCES)
|
||||||
OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS)
|
OBJECTS = $(nlmconv_OBJECTS) $(srconv_OBJECTS) $(sysdump_OBJECTS) $(coffdump_OBJECTS) $(dlltool_OBJECTS) $(windres_OBJECTS) $(dllwrap_OBJECTS) $(size_OBJECTS) $(objdump_OBJECTS) $(ar_OBJECTS) $(strings_OBJECTS) $(ranlib_OBJECTS) $(objcopy_OBJECTS) $(addr2line_OBJECTS) $(readelf_OBJECTS) $(nm_new_OBJECTS) $(strip_new_OBJECTS) $(cxxfilt_OBJECTS)
|
||||||
@ -1250,7 +1250,7 @@ debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
|||||||
$(INCDIR)/libiberty.h debug.h
|
$(INCDIR)/libiberty.h debug.h
|
||||||
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||||
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h dyn-string.h \
|
$(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/dyn-string.h \
|
||||||
dlltool.h
|
dlltool.h
|
||||||
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||||
@ -1344,11 +1344,9 @@ readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
|||||||
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \
|
||||||
$(INCDIR)/libiberty.h windres.h winduni.h
|
$(INCDIR)/libiberty.h windres.h winduni.h
|
||||||
dyn-string.o: dyn-string.c config.h $(INCDIR)/ansidecl.h \
|
|
||||||
dyn-string.h
|
|
||||||
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
$(INCDIR)/libiberty.h bucomm.h config.h $(INCDIR)/bin-bugs.h \
|
||||||
$(INCDIR)/fopen-same.h dyn-string.h
|
$(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h
|
||||||
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
|
||||||
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h
|
||||||
underscore.o: underscore.c
|
underscore.o: underscore.c
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
/* An abstract string datatype.
|
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
|
||||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
|
||||||
|
|
||||||
This file is part of GNU CC.
|
|
||||||
|
|
||||||
GNU CC is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
GNU CC is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/* This file lives in at least two places: binutils and gcc.
|
|
||||||
Don't change one without the other. */
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#ifdef IN_GCC
|
|
||||||
#include "system.h"
|
|
||||||
#include "gansidecl.h"
|
|
||||||
#else
|
|
||||||
#include "ansidecl.h"
|
|
||||||
#endif
|
|
||||||
#include "dyn-string.h"
|
|
||||||
|
|
||||||
extern char *xmalloc ();
|
|
||||||
extern char *xrealloc ();
|
|
||||||
|
|
||||||
/* Create a new dynamic string capable of holding at least SPACE
|
|
||||||
characters, including the terminating NUL. If SPACE is 0, it
|
|
||||||
will be silently increased to 1. */
|
|
||||||
|
|
||||||
dyn_string_t
|
|
||||||
dyn_string_new (space)
|
|
||||||
int space;
|
|
||||||
{
|
|
||||||
dyn_string_t result = (dyn_string_t) xmalloc (sizeof (struct dyn_string));
|
|
||||||
|
|
||||||
if (space == 0)
|
|
||||||
/* We need at least one byte in which to store the terminating
|
|
||||||
NUL. */
|
|
||||||
space = 1;
|
|
||||||
|
|
||||||
result->allocated = space;
|
|
||||||
result->s = (char*) xmalloc (space);
|
|
||||||
result->length = 0;
|
|
||||||
result->s[0] = '\0';
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free the memory used by DS. */
|
|
||||||
|
|
||||||
void
|
|
||||||
dyn_string_delete (ds)
|
|
||||||
dyn_string_t ds;
|
|
||||||
{
|
|
||||||
free (ds->s);
|
|
||||||
free (ds);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Append the NUL-terminated string S to DS, resizing DS if
|
|
||||||
necessary. */
|
|
||||||
|
|
||||||
dyn_string_t
|
|
||||||
dyn_string_append (ds, s)
|
|
||||||
dyn_string_t ds;
|
|
||||||
char *s;
|
|
||||||
{
|
|
||||||
int len = strlen (s);
|
|
||||||
dyn_string_resize (ds, ds->length + len + 1 /* '\0' */);
|
|
||||||
strcpy (ds->s + ds->length, s);
|
|
||||||
ds->length += len;
|
|
||||||
|
|
||||||
return ds;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Increase the capacity of DS so that it can hold at least SPACE
|
|
||||||
characters, including the terminating NUL. This function will not
|
|
||||||
(at present) reduce the capacity of DS. */
|
|
||||||
|
|
||||||
dyn_string_t
|
|
||||||
dyn_string_resize (ds, space)
|
|
||||||
dyn_string_t ds;
|
|
||||||
int space;
|
|
||||||
{
|
|
||||||
int new_allocated = ds->allocated;
|
|
||||||
|
|
||||||
while (space > new_allocated)
|
|
||||||
new_allocated *= 2;
|
|
||||||
|
|
||||||
if (new_allocated != ds->allocated)
|
|
||||||
{
|
|
||||||
/* We actually need more space. */
|
|
||||||
ds->allocated = new_allocated;
|
|
||||||
ds->s = (char*) xrealloc (ds->s, ds->allocated);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ds;
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
/* An abstract string datatype.
|
|
||||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
|
||||||
Contributed by Mark Mitchell (mark@markmitchell.com).
|
|
||||||
|
|
||||||
This file is part of GNU CC.
|
|
||||||
|
|
||||||
GNU CC is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation; either version 2, or (at your option)
|
|
||||||
any later version.
|
|
||||||
|
|
||||||
GNU CC is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program; if not, write to the Free Software
|
|
||||||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/* This file lives in at least two places: binutils and gcc.
|
|
||||||
Don't change one without the other. */
|
|
||||||
|
|
||||||
typedef struct dyn_string
|
|
||||||
{
|
|
||||||
int allocated; /* The amount of space allocated for the string. */
|
|
||||||
int length; /* The actual length of the string. */
|
|
||||||
char *s; /* The string itself, NUL-terminated. */
|
|
||||||
}* dyn_string_t;
|
|
||||||
|
|
||||||
extern dyn_string_t dyn_string_new PARAMS((int));
|
|
||||||
extern void dyn_string_delete PARAMS((dyn_string_t));
|
|
||||||
extern dyn_string_t dyn_string_append PARAMS((dyn_string_t, char*));
|
|
||||||
extern dyn_string_t dyn_string_resize PARAMS((dyn_string_t, int));
|
|
Loading…
Reference in New Issue
Block a user