History

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.

Thomas Preud'homme committed 12 years ago

Commit 9a6ee571 parent 5c233f21 file · +6 −0Browse files

Unified · Split

tccpp.c+6−0
@@ -255,9 +255,15 @@ ST_FUNC char *get_tok_str(int v, CValue *cv) · 254 unmodified lines
255255 static char buf[STRING_MAX_SIZE + 1];
256256 static CString cstr_buf;
257257 CString *cstr;
258+ CValue cval;
258259 char *p;
259260 int i, len;
260261
262+ if (!cv) {
263+ cval.ull = 0;
264+ cv = &cval;
265+ }
266+
261267 /* NOTE: to go faster, we give a fixed buffer for small strings */
262268 cstr_reset(&cstr_buf);
263269 cstr_buf.data = buf;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t