Make memory_error() a routine.

That makes the code more like Lemon as distributed.

Note that Lemon, as distributed, at least claims to have a bunch of
stuff "From the file "XXX.{c,h}", which might be the result of lemon.c
being an "amalgamation":

	https://www.sqlite.org/amalgamation.html

although, unlike SQLite, the individual bits of the amalgamation don't
appear to be present in the SQLite Fossil repository, so maybe they've
been permanently glued together.

Change-Id: I361d0d16be0744b127110d7d237fdd84e30b6432
Reviewed-on: https://code.wireshark.org/review/21105
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-04-14 19:24:05 -07:00
parent 3bd7671083
commit d523f615be
1 changed files with 10 additions and 2 deletions

View File

@ -422,8 +422,8 @@ struct lemon {
};
#define MemoryCheck(X) if((X)==0){ \
fprintf(stderr,"Out of memory. Aborting...\n"); \
exit(1); \
extern void memory_error(void); \
memory_error(); \
}
/**************** From the file "table.h" *********************************/
@ -1513,6 +1513,14 @@ make_basename(char* fullname)
return new_string;
}
/* Report an out-of-memory condition and abort. This function
** is used mostly by the "MemoryCheck" macro in struct.h
*/
void memory_error(void){
fprintf(stderr,"Out of memory. Aborting...\n");
exit(1);
}
static int nDefine = 0; /* Number of -D options on the command line */
static char **azDefine = 0; /* Name of the -D macros */