Fix uninitialized variable
`enumroot` was used before initialized in declglb() when compiling code such as tests/unused_symbol_line_gh_252.pwn.
This commit is contained in:
parent
2f04b12acd
commit
5e4da78933
@ -1998,7 +1998,7 @@ static void declglb(char *firstname,int firsttag,int fpublic,int fstatic,int fst
|
|||||||
int numdim;
|
int numdim;
|
||||||
short filenum;
|
short filenum;
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
constvalue_root *enumroot;
|
constvalue_root *enumroot=NULL;
|
||||||
#if !defined NDEBUG
|
#if !defined NDEBUG
|
||||||
cell glbdecl=0;
|
cell glbdecl=0;
|
||||||
#endif
|
#endif
|
||||||
@ -2251,7 +2251,7 @@ static int declloc(int fstatic)
|
|||||||
int idxtag[sDIMEN_MAX];
|
int idxtag[sDIMEN_MAX];
|
||||||
char name[sNAMEMAX+1];
|
char name[sNAMEMAX+1];
|
||||||
symbol *sym;
|
symbol *sym;
|
||||||
constvalue_root *enumroot;
|
constvalue_root *enumroot=NULL;
|
||||||
cell val,size;
|
cell val,size;
|
||||||
char *str;
|
char *str;
|
||||||
value lval = {0};
|
value lval = {0};
|
||||||
@ -2887,8 +2887,8 @@ static void decl_enum(int vclass,int fstatic)
|
|||||||
char *str;
|
char *str;
|
||||||
int tag,explicittag;
|
int tag,explicittag;
|
||||||
cell increment,multiplier;
|
cell increment,multiplier;
|
||||||
constvalue_root *enumroot;
|
constvalue_root *enumroot=NULL;
|
||||||
symbol *enumsym;
|
symbol *enumsym=NULL;
|
||||||
short filenum;
|
short filenum;
|
||||||
|
|
||||||
filenum=fcurrent;
|
filenum=fcurrent;
|
||||||
@ -2944,9 +2944,6 @@ static void decl_enum(int vclass,int fstatic)
|
|||||||
if ((enumroot=(constvalue_root*)malloc(sizeof(constvalue_root)))==NULL)
|
if ((enumroot=(constvalue_root*)malloc(sizeof(constvalue_root)))==NULL)
|
||||||
error(103); /* insufficient memory (fatal error) */
|
error(103); /* insufficient memory (fatal error) */
|
||||||
memset(enumroot,0,sizeof(constvalue_root));
|
memset(enumroot,0,sizeof(constvalue_root));
|
||||||
} else {
|
|
||||||
enumsym=NULL;
|
|
||||||
enumroot=NULL;
|
|
||||||
} /* if */
|
} /* if */
|
||||||
|
|
||||||
needtoken('{');
|
needtoken('{');
|
||||||
@ -4122,7 +4119,7 @@ static void doarg(char *name,int ident,int offset,int tags[],int numtags,
|
|||||||
int fpublic,int fconst,int chkshadow,arginfo *arg)
|
int fpublic,int fconst,int chkshadow,arginfo *arg)
|
||||||
{
|
{
|
||||||
symbol *argsym;
|
symbol *argsym;
|
||||||
constvalue_root *enumroot;
|
constvalue_root *enumroot=NULL;
|
||||||
cell size;
|
cell size;
|
||||||
|
|
||||||
strcpy(arg->name,name);
|
strcpy(arg->name,name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user