Commit 7cd86c4d authored by korbb's avatar korbb
Browse files

removed dinkleberries and use xmalloc instead of a private version

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34986 138bc75d-0d04-0410-961f-82ee72b054a4
parent b0a314a7
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> 2000-07-12 Neil Booth <NeilB@earthling.net>
   
* cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c. * cpphash.h: (TOKEN_SPELL) Pulled from cpplex.c.
......
...@@ -567,7 +567,7 @@ FIX_PROC_HEAD( wrap_fix ) ...@@ -567,7 +567,7 @@ FIX_PROC_HEAD( wrap_fix )
*(pz_dst++) = '_'; *(pz_dst++) = '_';
if (++len >= sizeof( z_fixname )) { 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 ); memcpy( p, (void*)z_fixname, len );
pz_name = (tCC*)p; pz_name = (tCC*)p;
pz_dst = (char*)pz_name + len; pz_dst = (char*)pz_name + len;
......
...@@ -206,6 +206,8 @@ initialize ( argc, argv ) ...@@ -206,6 +206,8 @@ initialize ( argc, argv )
"fixincl ERROR: %s environment variable not defined\n\ "fixincl ERROR: %s environment variable not defined\n\
\tTARGET_MACHINE, DESTDIR, SRCDIR and FIND_BASE are required\n"; \tTARGET_MACHINE, DESTDIR, SRCDIR and FIND_BASE are required\n";
xmalloc_set_program_name (argv[0]);
switch (argc) switch (argc)
{ {
case 1: case 1:
......
...@@ -24,20 +24,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -24,20 +24,6 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h" #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. load_file_data loads all the contents of a file into malloc-ed memory.
...@@ -95,7 +81,7 @@ load_file_data (fp) ...@@ -95,7 +81,7 @@ load_file_data (fp)
return pz_data; return pz_data;
} }
#ifdef IS_CXX_HEADER_NEEDED
t_bool t_bool
is_cxx_header (fname, text) is_cxx_header (fname, text)
tCC *fname; tCC *fname;
...@@ -153,6 +139,44 @@ template[ \t]*<|\ ...@@ -153,6 +139,44 @@ template[ \t]*<|\
return BOOL_FALSE; 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 */
/* * * * * * * * * * * * * /* * * * * * * * * * * * *
......
...@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */ ...@@ -31,6 +31,7 @@ Boston, MA 02111-1307, USA. */
#include "gnu-regex.h" #include "gnu-regex.h"
#include "machname.h" #include "machname.h"
#include "libiberty.h"
#ifndef STDIN_FILENO #ifndef STDIN_FILENO
# define STDIN_FILENO 0 # define STDIN_FILENO 0
...@@ -152,10 +153,14 @@ struct fix_desc ...@@ -152,10 +153,14 @@ struct fix_desc
* Exported procedures * Exported procedures
*/ */
char * load_file_data _P_(( FILE* fp )); char * load_file_data _P_(( FILE* fp ));
#ifdef IS_CXX_HEADER_NEEDED
t_bool is_cxx_header _P_(( tCC* filename, tCC* filetext )); 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, void compile_re _P_(( tCC* pat, regex_t* re, int match,
tCC *e1, tCC *e2 )); tCC *e1, tCC *e2 ));
void* must_malloc _P_(( size_t ));
void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname )); void apply_fix _P_(( tFixDesc* p_fixd, tCC* filname ));
apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text )); apply_fix_p_t run_test _P_((tCC* t_name, tCC* f_name, tCC* text ));
......
...@@ -47,9 +47,6 @@ Boston, MA 02111-1307, USA. */ ...@@ -47,9 +47,6 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h" #include "fixlib.h"
#define SHOULD_APPLY(afp) ((afp) == APPLY_FIX)
apply_fix_p_t run_test();
typedef struct { typedef struct {
tCC* test_name; tCC* test_name;
apply_fix_p_t (*test_proc)(); apply_fix_p_t (*test_proc)();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment