removed dinkleberries and use xmalloc instead of a private version
authorBruce Korb <bkorb@gnu.org>
Wed, 12 Jul 2000 14:45:05 +0000 (14:45 +0000)
committerBruce Korb <korbb@gcc.gnu.org>
Wed, 12 Jul 2000 14:45:05 +0000 (14:45 +0000)
From-SVN: r34986

gcc/ChangeLog
gcc/fixinc/fixfixes.c
gcc/fixinc/fixincl.c
gcc/fixinc/fixlib.c
gcc/fixinc/fixlib.h
gcc/fixinc/fixtests.c

index efd792c..cf039be 100644 (file)
@@ -1,3 +1,13 @@
+2000-07-12  Bruce Korb  <bkorb@gnu.org>
+
+       * fixinc/fixfixes.c: use xmalloc
+       * fixinc/fixincl.c(initialize): set program name for xmalloc
+       * fixinc/fixlib.c(must_malloc): obsolete
+       (is_cxx_header): no longer used - disabled
+       (skip_quote): inserted and disabled for future use
+       * fixinc/fixlib.h: reflects above
+       * fixinc/fixtests.c: removed dinkleberries
+
 2000-07-12  Neil Booth  <NeilB@earthling.net>
 
        * cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
index 4719a51..dd08e80 100644 (file)
@@ -567,7 +567,7 @@ FIX_PROC_HEAD( wrap_fix )
       *(pz_dst++) = '_';
 
     if (++len >= sizeof( z_fixname )) {
-      void* p = must_malloc( len + strlen( pz_src ) + 1 );
+      void* p = xmalloc( len + strlen( pz_src ) + 1 );
       memcpy( p, (void*)z_fixname, len );
       pz_name = (tCC*)p;
       pz_dst  = (char*)pz_name + len;
index 1dfc6ad..113827f 100644 (file)
@@ -206,6 +206,8 @@ initialize ( argc, argv )
     "fixincl ERROR:  %s environment variable not defined\n\
 \tTARGET_MACHINE, DESTDIR, SRCDIR and FIND_BASE are required\n";
 
+  xmalloc_set_program_name (argv[0]);
+
   switch (argc)
     {
     case 1:
index bafe261..c2c77eb 100644 (file)
@@ -24,20 +24,6 @@ Boston, MA 02111-1307, USA.  */
 
 #include "fixlib.h"
 
-void *
-must_malloc( siz )
-    size_t  siz;
-{
-  void*  res = malloc( siz );
-
-  if (res == (void*)NULL) {
-    fprintf( stderr, "fixincl failed to malloc %d bytes\n", siz );
-    exit( 3 );
-  }
-
-  return res;
-}
-
 /* * * * * * * * * * * * *
  
    load_file_data loads all the contents of a file into malloc-ed memory.
@@ -95,7 +81,7 @@ load_file_data (fp)
   return pz_data;
 }
 
-
+#ifdef IS_CXX_HEADER_NEEDED
 t_bool
 is_cxx_header (fname, text)
      tCC *fname;
@@ -153,6 +139,44 @@ template[ \t]*<|\
                   
   return BOOL_FALSE;
 }
+#endif /* CXX_TYPE_NEEDED */
+
+#ifdef SKIP_QUOTE_NEEDED
+/*
+ *  Skip over a quoted string.  Single quote strings may
+ *  contain multiple characters if the first character is
+ *  a backslash.  Especially a backslash followed by octal digits.
+ *  We are not doing a correctness syntax check here.
+ */
+tCC*
+skip_quote( q, text )
+  char  q;
+  char* text;
+{
+  for (;;)
+    {
+      char ch = *(text++);
+      switch (ch)
+        {
+        case '\\':
+          text++; /* skip over whatever character follows */
+          break;
+
+        case '"':
+        case '\'':
+          if (ch != q)
+            break;
+          /*FALLTHROUGH*/
+
+        case '\n':
+        case NUL:
+          goto skip_done;
+        }
+    } skip_done:;
+
+  return text;
+}
+#endif /* SKIP_QUOTE_NEEDED */
 
 /* * * * * * * * * * * * *
  
index 5cbf412..9997553 100644 (file)
@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA.  */
 
 #include "gnu-regex.h"
 #include "machname.h"
+#include "libiberty.h"
 
 #ifndef STDIN_FILENO
 # define STDIN_FILENO   0
@@ -152,10 +153,14 @@ struct fix_desc
  *  Exported procedures
  */
 char * load_file_data _P_(( FILE* fp ));
+#ifdef IS_CXX_HEADER_NEEDED
 t_bool is_cxx_header  _P_(( tCC* filename, tCC* filetext ));
+#endif /* IS_CXX_HEADER_NEEDED */
+#ifdef SKIP_QUOTE_NEEDED
+tCC*   skip_quote  _P_(( char  q, char* text ));
+#endif
 void   compile_re     _P_(( tCC* pat, regex_t* re, int match,
                            tCC *e1, tCC *e2 ));
-void*  must_malloc    _P_(( size_t ));
 
 void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname ));
 apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text ));
index 36dd655..0da04b5 100644 (file)
@@ -47,9 +47,6 @@ Boston, MA 02111-1307, USA.  */
 
 #include "fixlib.h"
 
-#define SHOULD_APPLY(afp) ((afp) == APPLY_FIX)
-apply_fix_p_t run_test();
-
 typedef struct {
     tCC*  test_name;
     apply_fix_p_t (*test_proc)();