OSDN Git Service

(expand_computed_goto): Convert from ptr_mode to Pmode.
[pf3gnuchains/gcc-fork.git] / gcc / bi-lexer.c
index 954638a..0766b5f 100644 (file)
@@ -18,12 +18,9 @@ along with GNU CC; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 #include <stdio.h>
+#include "hconfig.h"
 #include "bi-parser.h"
 
-extern char *malloc ();
-extern char *realloc ();
-
-
 /* Current read buffer and point */
 static char *buffer = NULL;
 static char *inpoint = NULL;
@@ -36,12 +33,12 @@ static char *
 xmalloc (nbytes)
      int nbytes;
 {
-  char *tmp = malloc (nbytes);
+  char *tmp = (char *) malloc (nbytes);
 
   if (!tmp)
     {
       fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
-      exit (1);
+      exit (FATAL_EXIT_CODE);
     }
 
   return tmp;
@@ -56,12 +53,14 @@ xrealloc (block, nbytes)
      char *block;
      int nbytes;
 {
-  char *tmp = realloc (block, nbytes);
+  char *tmp = (block
+              ? (char *) realloc (block, nbytes)
+              : (char *) malloc (nbytes));
 
   if (!tmp)
     {
       fprintf (stderr, "can't reallocate %d bytes (out of virtual memory)\n", nbytes);
-      exit (1);
+      exit (FATAL_EXIT_CODE);
     }
 
   return tmp;
@@ -92,7 +91,7 @@ scan_string ()
          int previous_point_index = point - buffer;
 
          buffer_size = (!buffer_size ? 32 : buffer_size * 2);
-         if (buffer)
+         if (!buffer)
            buffer = xmalloc (buffer_size);
          else
            buffer = xrealloc (buffer, buffer_size);