Commit e864e871 authored by Martin Ruckert's avatar Martin Ruckert

initilizing err_buf early to avoid NULL pointer in panic

parent 277cd082
...@@ -25,6 +25,14 @@ jmp_buf mmixal_exit; ...@@ -25,6 +25,14 @@ jmp_buf mmixal_exit;
#endif #endif
@z @z
We need to initialize buffers, especially err_buf, very early.
@x
@<Initialize everything@>=
@y
@<Allocate buffers@>=
@z
We change error messages that handle errors in the command line We change error messages that handle errors in the command line
(there is none). Errors are no longer written to stderr. (there is none). Errors are no longer written to stderr.
...@@ -271,6 +279,14 @@ We allocat single sym nodes to be able to free them. ...@@ -271,6 +279,14 @@ We allocat single sym nodes to be able to free them.
if (!p) panic("Capacity exceeded: Out of symbol memory"); if (!p) panic("Capacity exceeded: Out of symbol memory");
@z @z
Now we start with the rest of the initialization.
@x
@<Init...@>=
@y
@<Initialize everything@>=
@z
The special names are already defined in mmix-sim.w The special names are already defined in mmix-sim.w
@x @x
...@@ -427,7 +443,10 @@ int mmixal(char *mms_name, char *mmo_name, char *mml_name, int x_option, int b_o ...@@ -427,7 +443,10 @@ int mmixal(char *mms_name, char *mmo_name, char *mml_name, int x_option, int b_o
if (err_count!=0){ if (err_count!=0){
prune(trie_root); prune(trie_root);
goto clean_up; goto clean_up;
} }
buf_size = b_option;
expanding = x_option;
@<Allocate buffers@>
if (mms_name==NULL) if (mms_name==NULL)
panic("No input file name"); panic("No input file name");
src_file_name= mms_name; src_file_name= mms_name;
...@@ -439,8 +458,6 @@ int mmixal(char *mms_name, char *mmo_name, char *mml_name, int x_option, int b_o ...@@ -439,8 +458,6 @@ int mmixal(char *mms_name, char *mmo_name, char *mml_name, int x_option, int b_o
listing_name[0]=0; listing_name[0]=0;
else else
strncpy(listing_name,mml_name,FILENAME_MAX); strncpy(listing_name,mml_name,FILENAME_MAX);
expanding = x_option;
buf_size = b_option;
cur_file=0; cur_file=0;
line_no=0; line_no=0;
long_warning_given=0; long_warning_given=0;
......
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