some fixes:
- use Malloc, Realloc instead of malloc, realloc - generate common for un-initialized bss - removed null-reference
This commit is contained in:
parent
0ba4588be1
commit
ed651bbd04
3 changed files with 5 additions and 7 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include "decl.h"
|
#include "decl.h"
|
||||||
#include <alloc.h>
|
#include <alloc.h>
|
||||||
extern char *malloc(), *realloc(), *Salloc();
|
|
||||||
|
|
||||||
/* This file contains some routines needed in "pars.g" to handle the action-
|
/* This file contains some routines needed in "pars.g" to handle the action-
|
||||||
* grammarrule. The assembler-instructions are handeld in blocks rather than
|
* grammarrule. The assembler-instructions are handeld in blocks rather than
|
||||||
|
@ -24,7 +23,7 @@ init_as_block()
|
||||||
|
|
||||||
if ( quantum == 0) {
|
if ( quantum == 0) {
|
||||||
quantum = 16;
|
quantum = 16;
|
||||||
as_instructions = (char **)malloc( quantum*sizeof( char *));
|
as_instructions = (char **)Malloc( quantum*sizeof( char *));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ char *instr;
|
||||||
{
|
{
|
||||||
if ( nr_instr == quantum) {
|
if ( nr_instr == quantum) {
|
||||||
quantum *= 2;
|
quantum *= 2;
|
||||||
as_instructions = (char **) realloc( as_instructions,
|
as_instructions = (char **) Realloc( as_instructions,
|
||||||
quantum*sizeof( char *));
|
quantum*sizeof( char *));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ handle_defaults()
|
||||||
* ponding C_con_xxx C_rom_xxx instruction
|
* ponding C_con_xxx C_rom_xxx instruction
|
||||||
* so set correct info.
|
* so set correct info.
|
||||||
*/
|
*/
|
||||||
set_C_instr_info( def_info[i-2].name);
|
set_C_instr_info( def_info[(i>>2)<<2].name);
|
||||||
def_row();
|
def_row();
|
||||||
out( "}\n\n");
|
out( "}\n\n");
|
||||||
}
|
}
|
||||||
|
@ -244,8 +244,7 @@ extnd_header()
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
out( "if ( %s == 0 ) {\n", C_instr_info->arg_id[3]);
|
out( "if ( %s == 0 ) {\n", C_instr_info->arg_id[3]);
|
||||||
set_segment( SEGBSS);
|
out( "common( %s);\n", C_instr_info->arg_id[0]);
|
||||||
out( "bss( %s);\n", C_instr_info->arg_id[0]);
|
|
||||||
out( "}\nelse {\n");
|
out( "}\nelse {\n");
|
||||||
set_segment( SEGCON);
|
set_segment( SEGCON);
|
||||||
out( "for ( %s = 0; %s < %s/EM_WSIZE; %s++)\n",
|
out( "for ( %s = 0; %s < %s/EM_WSIZE; %s++)\n",
|
||||||
|
|
|
@ -169,7 +169,7 @@ c_row : %if ( to_change && strcmp( yytext, to_change) == 0)
|
||||||
| C_INSTR
|
| C_INSTR
|
||||||
[ c_special | c_simple]
|
[ c_special | c_simple]
|
||||||
|
|
||||||
| %if ( strcmp( yytext, to_change) == 0)
|
| %if ( to_change && strcmp( yytext, to_change) == 0)
|
||||||
DEF_C_INSTR { init_defaults( yytext);}
|
DEF_C_INSTR { init_defaults( yytext);}
|
||||||
[ Dspecial | Dsimple] { handle_defaults();}
|
[ Dspecial | Dsimple] { handle_defaults();}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue