2004-07-19 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gas / sb.c
index bbb298d0a0c4fa1a33efda180f3b59b57adddb84..27b29eee9cdc4b7157c731947e5cb0fbb3eeb9d8 100644 (file)
--- a/gas/sb.c
+++ b/gas/sb.c
@@ -1,5 +1,5 @@
 /* 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"
 
@@ -45,7 +52,7 @@
 
 #define dsize 5
 
-static void sb_check PARAMS ((sb *, int));
+static void sb_check (sb *, int);
 
 /* Statistics of sb structures.  */
 
@@ -55,12 +62,10 @@ int string_count[sb_max_power_two];
 
 static sb_list_vector free_list;
 
-/* initializes an sb. */
+/* initializes an sb.  */
 
 void
-sb_build (ptr, size)
-     sb *ptr;
-     int size;
+sb_build (sb *ptr, int size)
 {
   /* see if we can find one to allocate */
   sb_element *e;
@@ -90,10 +95,8 @@ sb_build (ptr, size)
   ptr->item = e;
 }
 
-
 void
-sb_new (ptr)
-     sb *ptr;
+sb_new (sb *ptr)
 {
   sb_build (ptr, dsize);
 }
@@ -101,8 +104,7 @@ sb_new (ptr)
 /* deallocate the sb at ptr */
 
 void
-sb_kill (ptr)
-     sb *ptr;
+sb_kill (sb *ptr)
 {
   /* return item to free list */
   ptr->item->next = free_list.size[ptr->pot];
@@ -112,9 +114,7 @@ sb_kill (ptr)
 /* add the sb at s to the end of the sb at ptr */
 
 void
-sb_add_sb (ptr, s)
-     sb *ptr;
-     sb *s;
+sb_add_sb (sb *ptr, sb *s)
 {
   sb_check (ptr, s->len);
   memcpy (ptr->ptr + ptr->len, s->ptr, s->len);
@@ -122,12 +122,10 @@ sb_add_sb (ptr, s)
 }
 
 /* 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)
-     sb *ptr;
-     int len;
+sb_check (sb *ptr, int len)
 {
   if (ptr->len + len >= 1 << ptr->pot)
     {
@@ -145,29 +143,24 @@ sb_check (ptr, len)
 /* make the sb at ptr point back to the beginning.  */
 
 void
-sb_reset (ptr)
-     sb *ptr;
+sb_reset (sb *ptr)
 {
   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)
-     sb *ptr;
-     int c;
+sb_add_char (sb *ptr, int c)
 {
   sb_check (ptr, 1);
   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)
-     sb *ptr;
-     const char *s;
+sb_add_string (sb *ptr, const char *s)
 {
   int len = strlen (s);
   sb_check (ptr, len);
@@ -178,10 +171,7 @@ sb_add_string (ptr, s)
 /* add string at s of length len to sb at ptr */
 
 void
-sb_add_buffer (ptr, s, len)
-     sb *ptr;
-     const char *s;
-     int len;
+sb_add_buffer (sb *ptr, const char *s, int len)
 {
   sb_check (ptr, len);
   memcpy (ptr->ptr + ptr->len, s, len);
@@ -191,9 +181,7 @@ sb_add_buffer (ptr, s, len)
 /* print the sb at ptr to the output file */
 
 void
-sb_print (outfile, ptr)
-     FILE *outfile;
-     sb *ptr;
+sb_print (FILE *outfile, sb *ptr)
 {
   int i;
   int nc = 0;
@@ -209,11 +197,8 @@ sb_print (outfile, ptr)
     }
 }
 
-void 
-sb_print_at (outfile, idx, ptr)
-     FILE *outfile;
-     int idx;
-     sb *ptr;
+void
+sb_print_at (FILE *outfile, int idx, sb *ptr)
 {
   int i;
   for (i = idx; i < ptr->len; i++)
@@ -221,11 +206,10 @@ sb_print_at (outfile, idx, ptr)
 }
 
 /* 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)
-     sb *in;
+sb_name (sb *in)
 {
   /* stick a null on the end of the string */
   sb_add_char (in, 0);
@@ -235,8 +219,7 @@ sb_name (in)
 /* like sb_name, but don't include the null byte in the string.  */
 
 char *
-sb_terminate (in)
-     sb *in;
+sb_terminate (sb *in)
 {
   sb_add_char (in, 0);
   --in->len;
@@ -247,9 +230,7 @@ sb_terminate (in)
    whitespace. return the index of the first non whitespace character */
 
 int
-sb_skip_white (idx, ptr)
-     int idx;
-     sb *ptr;
+sb_skip_white (int idx, sb *ptr)
 {
   while (idx < ptr->len
         && (ptr->ptr[idx] == ' '
@@ -259,13 +240,11 @@ sb_skip_white (idx, ptr)
 }
 
 /* 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. */
+   a comma and any following whitespace. returns the index of the
+   next character.  */
 
 int
-sb_skip_comma (idx, ptr)
-     int idx;
-     sb *ptr;
+sb_skip_comma (int idx, sb *ptr)
 {
   while (idx < ptr->len
         && (ptr->ptr[idx] == ' '
This page took 0.039931 seconds and 4 git commands to generate.