mirror of
https://github.com/lua/lua
synced 2026-09-29 04:35:58 +03:00
avoid expression with side effect (in debug mode) inside 'sizeof'
This commit is contained in:
parent
3a91274547
commit
fcc6e1220e
1 changed files with 3 additions and 2 deletions
5
ldump.c
5
ldump.c
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ldump.c,v 2.34 2014/11/02 19:19:04 roberto Exp roberto $
|
||||
** $Id: ldump.c,v 2.35 2015/01/16 16:54:37 roberto Exp roberto $
|
||||
** save precompiled Lua chunks
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
|
@ -75,13 +75,14 @@ static void DumpString (const TString *s, DumpState *D) {
|
|||
DumpByte(0, D);
|
||||
else {
|
||||
size_t size = tsslen(s) + 1; /* include trailing '\0' */
|
||||
const char *str = getstr(s);
|
||||
if (size < 0xFF)
|
||||
DumpByte(cast_int(size), D);
|
||||
else {
|
||||
DumpByte(0xFF, D);
|
||||
DumpVar(size, D);
|
||||
}
|
||||
DumpVector(getstr(s), size - 1, D); /* no need to save '\0' */
|
||||
DumpVector(str, size - 1, D); /* no need to save '\0' */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue