diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-14 19:24:05 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-15 02:33:52 +0000 |
commit | d523f615beab84b9ce6224c42d8555c619825e31 (patch) | |
tree | e963a35ad8c0f11a348493f4d062a4121efe2ec9 /tools | |
parent | 3bd767108391e6d3498241b20e86ca176dffc185 (diff) | |
download | wireshark-d523f615beab84b9ce6224c42d8555c619825e31.tar.gz |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lemon/lemon.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tools/lemon/lemon.c b/tools/lemon/lemon.c index e5d1a4f18e..68f7071adc 100644 --- a/tools/lemon/lemon.c +++ b/tools/lemon/lemon.c @@ -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 */ |