aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorGeoffrey Noer <noer@cygnus>1998-10-08 22:47:18 +0000
committerGeoffrey Noer <noer@cygnus>1998-10-08 22:47:18 +0000
commitd7a198b63657a7b9f031bf310d6202b9d8aaae75 (patch)
treeff1ac877d0d41f2d2c73dfd0915c1bbcbcc6b8fe /binutils
parent209c77a838fb6719d4e751d308a0832c4caaa2e1 (diff)
downloadfsf-binutils-gdb-d7a198b63657a7b9f031bf310d6202b9d8aaae75.zip
fsf-binutils-gdb-d7a198b63657a7b9f031bf310d6202b9d8aaae75.tar.gz
fsf-binutils-gdb-d7a198b63657a7b9f031bf310d6202b9d8aaae75.tar.bz2
Thu Oct 8 15:33:08 1998 Geoffrey Noer <noer@cygnus.com>
* configure.in: call AC_EXEEXT instead of AM_EXEEXT and AM_CYGWIN32. * aclocal.m4: remove local AM_EXEEXT/AM_CYGWIN32 macros. * configure: regenerate Thu Oct 8 15:33:08 1998 Geoffrey Noer <noer@cygnus.com> From Mumit Khan <khan@xraylith.wisc.edu>: * dlltool.c (scan_all_symbols): Don't re-export symbols exported by other DLLs. Thu Oct 8 15:33:08 1998 Geoffrey Noer <noer@cygnus.com> * Makefile.am (BUILD_DLLWRAP): Add. (BUILD_DLLWRAP, DLLWRAP_PROG): Add. (bin_PROGRAMS): Add dllwrap. * Makefile.in: regenerate with automake From Mumit Khan <khan@xraylith.wisc.edu>: * dllwrap.c: New file from dllhelpers v0.2.1. (print_version): New function. (long_options): Add --version. (main): Handle. * dyn-string.h, dyn-string.c: New files from egcs-1.1/gcc. * configure.in (BUILD_DLLWRAP): Add. * configure: Regenerate.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/.Sanitize3
-rw-r--r--binutils/dyn-string.c107
-rw-r--r--binutils/dyn-string.h34
3 files changed, 144 insertions, 0 deletions
diff --git a/binutils/.Sanitize b/binutils/.Sanitize
index 6366e1e..7d34712 100644
--- a/binutils/.Sanitize
+++ b/binutils/.Sanitize
@@ -60,6 +60,9 @@ defparse.y
dep-in.sed
dlltool.c
dlltool.h
+dllwrap.c
+dyn-string.c
+dyn-string.h
filemode.c
ieee.c
is-ranlib.c
diff --git a/binutils/dyn-string.c b/binutils/dyn-string.c
new file mode 100644
index 0000000..a4a3043
--- /dev/null
+++ b/binutils/dyn-string.c
@@ -0,0 +1,107 @@
+/* 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 GNU CC; see the file COPYING. If not, write to the Free
+ Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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;
+}
diff --git a/binutils/dyn-string.h b/binutils/dyn-string.h
new file mode 100644
index 0000000..a22bbbf
--- /dev/null
+++ b/binutils/dyn-string.h
@@ -0,0 +1,34 @@
+/* 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 GNU CC; see the file COPYING. If not, write to the Free
+ Software Foundation, 675 Mass Ave, Cambridge, MA 02139, 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));