/* sb.c - string buffer manipulation routines
- Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+ Copyright 1994, 1995, 2000 Free Software Foundation, Inc.
Written by Steve and Judy Chamberlain of Cygnus Support,
sac@cygnus.com
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
+ 02111-1307, USA. */
#include "config.h"
#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+#include "libiberty.h"
#include "sb.h"
/* These routines are about manipulating strings.
static sb_list_vector free_list;
-/* initializes an sb. */
+/* initializes an sb. */
void
sb_build (ptr, size)
/* see if we can find one to allocate */
sb_element *e;
-#undef abort
if (size > sb_max_power_two)
abort ();
ptr->item = e;
}
-
void
sb_new (ptr)
sb *ptr;
}
/* make sure that the sb at ptr has room for another len characters,
- and grow it if it doesn't. */
+ and grow it if it doesn't. */
static void
sb_check (ptr, len)
ptr->len = 0;
}
-/* add character c to the end of the sb at ptr. */
+/* add character c to the end of the sb at ptr. */
void
sb_add_char (ptr, c)
ptr->ptr[ptr->len++] = c;
}
-/* add null terminated string s to the end of sb at ptr. */
+/* add null terminated string s to the end of sb at ptr. */
void
sb_add_string (ptr, s)
}
}
-void
+void
sb_print_at (outfile, idx, ptr)
FILE *outfile;
int idx;
}
/* put a null at the end of the sb at in and return the start of the
- string, so that it can be used as an arg to printf %s. */
+ string, so that it can be used as an arg to printf %s. */
char *
sb_name (in)
/* start at the index idx into the sb at ptr. skips whitespace,
a comma and any following whitespace. returnes the index of the
- next character. */
+ next character. */
int
sb_skip_comma (idx, ptr)