OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / scan.c
index 63e2470..e9a9a4b 100644 (file)
@@ -1,5 +1,5 @@
 /* Utility functions for scan-decls and fix-header programs.
-   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -35,10 +35,7 @@ make_sstring_space (str, count)
   if (new_size <= cur_size)
     return;
   
-  if (str->base == NULL)
-    str->base = xmalloc (new_size);
-  else
-    str->base = xrealloc (str->base, new_size);
+  str->base = xrealloc (str->base, new_size);
   str->ptr = str->base + cur_size;
   str->limit = str->base + new_size;
 }
@@ -48,8 +45,9 @@ sstring_append (dst, src)
      sstring *dst;
      sstring *src;
 {
-  register char *d, *s;
-  register int count = SSTRING_LENGTH(src);
+  char *d, *s;
+  int count = SSTRING_LENGTH(src);
+
   MAKE_SSTRING_SPACE(dst, count + 1);
   d = dst->ptr;
   s = src->base;
@@ -60,8 +58,8 @@ sstring_append (dst, src)
 
 int
 scan_ident (fp, s, c)
-     register FILE *fp;
-     register sstring *s;
+     FILE *fp;
+     sstring *s;
      int c;
 {
   s->ptr = s->base;
@@ -82,11 +80,12 @@ scan_ident (fp, s, c)
 
 int
 scan_string (fp, s, init)
-     register FILE *fp;
-     register sstring *s;
+     FILE *fp;
+     sstring *s;
      int init;
 {
   int c;
+
   for (;;)
     {
       c = getc (fp);
@@ -116,7 +115,7 @@ scan_string (fp, s, init)
 
 int
 skip_spaces (fp, c)
-     register FILE *fp;
+     FILE *fp;
      int c;
 {
   for (;;)
@@ -159,6 +158,7 @@ read_upto (fp, str, delim)
      int delim;
 {
   int ch;
+
   for (;;)
     {
       ch = getc (fp);
@@ -173,10 +173,11 @@ read_upto (fp, str, delim)
 
 int
 get_token (fp, s)
-     register FILE *fp;
-     register sstring *s;
+     FILE *fp;
+     sstring *s;
 {
   int c;
+
   s->ptr = s->base;
  retry:
   c = ' ';
@@ -239,3 +240,18 @@ get_token (fp, s)
   *s->ptr = 0;
   return c;
 }
+
+unsigned int
+hashstr (str, len)
+     const char *str;
+     unsigned int len;
+{
+  unsigned int n = len;
+  unsigned int r = 0;
+  const unsigned char *s = (const unsigned char *)str;
+
+  do
+    r = r * 67 + (*s++ - 113);
+  while (--n);
+  return r + len;
+}