diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-30 12:43:51 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-03-30 12:43:51 -0300 |
| commit | fcc6e1220e8600502d463fc8e785849450c18db9 (patch) | |
| tree | be6969926a9ade0797461db0c75f6eb34f0067df | |
| parent | 3a91274547051935f92a9a51e1fad276810c73a0 (diff) | |
| download | lua-fcc6e1220e8600502d463fc8e785849450c18db9.tar.gz lua-fcc6e1220e8600502d463fc8e785849450c18db9.tar.bz2 lua-fcc6e1220e8600502d463fc8e785849450c18db9.zip | |
avoid expression with side effect (in debug mode) inside 'sizeof'
| -rw-r--r-- | ldump.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ldump.c,v 2.34 2014/11/02 19:19:04 roberto Exp roberto $ | 2 | ** $Id: ldump.c,v 2.35 2015/01/16 16:54:37 roberto Exp roberto $ |
| 3 | ** save precompiled Lua chunks | 3 | ** save precompiled Lua chunks |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -75,13 +75,14 @@ static void DumpString (const TString *s, DumpState *D) { | |||
| 75 | DumpByte(0, D); | 75 | DumpByte(0, D); |
| 76 | else { | 76 | else { |
| 77 | size_t size = tsslen(s) + 1; /* include trailing '\0' */ | 77 | size_t size = tsslen(s) + 1; /* include trailing '\0' */ |
| 78 | const char *str = getstr(s); | ||
| 78 | if (size < 0xFF) | 79 | if (size < 0xFF) |
| 79 | DumpByte(cast_int(size), D); | 80 | DumpByte(cast_int(size), D); |
| 80 | else { | 81 | else { |
| 81 | DumpByte(0xFF, D); | 82 | DumpByte(0xFF, D); |
| 82 | DumpVar(size, D); | 83 | DumpVar(size, D); |
| 83 | } | 84 | } |
| 84 | DumpVector(getstr(s), size - 1, D); /* no need to save '\0' */ | 85 | DumpVector(str, size - 1, D); /* no need to save '\0' */ |
| 85 | } | 86 | } |
| 86 | } | 87 | } |
| 87 | 88 | ||
