mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-26 12:04:59 +08:00
Make get_tok_str support NULL as second param.
As was pointed out on tinycc-devel, many uses of get_tok_str gives as second parameter the value NULL. However, that pointer was unconditionally dereferenced in get_tok_ptr. This commit explicitely add support for thas case.
This commit is contained in:
parent
5c233f2cf3
commit
9a6ee577f6
6
tccpp.c
6
tccpp.c
@ -255,9 +255,15 @@ ST_FUNC char *get_tok_str(int v, CValue *cv)
|
|||||||
static char buf[STRING_MAX_SIZE + 1];
|
static char buf[STRING_MAX_SIZE + 1];
|
||||||
static CString cstr_buf;
|
static CString cstr_buf;
|
||||||
CString *cstr;
|
CString *cstr;
|
||||||
|
CValue cval;
|
||||||
char *p;
|
char *p;
|
||||||
int i, len;
|
int i, len;
|
||||||
|
|
||||||
|
if (!cv) {
|
||||||
|
cval.ull = 0;
|
||||||
|
cv = &cval;
|
||||||
|
}
|
||||||
|
|
||||||
/* NOTE: to go faster, we give a fixed buffer for small strings */
|
/* NOTE: to go faster, we give a fixed buffer for small strings */
|
||||||
cstr_reset(&cstr_buf);
|
cstr_reset(&cstr_buf);
|
||||||
cstr_buf.data = buf;
|
cstr_buf.data = buf;
|
||||||
|
Loading…
Reference in New Issue
Block a user