aboutsummaryrefslogtreecommitdiff
path: root/ldump.c
diff options
context:
space:
mode:
Diffstat (limited to 'ldump.c')
-rw-r--r--ldump.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/ldump.c b/ldump.c
index 1078910f..5f0b7a46 100644
--- a/ldump.c
+++ b/ldump.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldump.c,v 2.22 2014/02/28 12:25:12 roberto Exp roberto $ 2** $Id: ldump.c,v 2.23 2014/02/28 16:13:01 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*/
@@ -60,16 +60,16 @@ static void DumpInteger(lua_Integer x, DumpState* D)
60 60
61static void DumpString(const TString* s, DumpState* D) 61static void DumpString(const TString* s, DumpState* D)
62{ 62{
63 if (s==NULL) 63 if (s==NULL) DumpByte(0,D);
64 { 64 else {
65 size_t size=0; 65 size_t size = s->tsv.len+1; /* include trailing '\0' */
66 DumpVar(size,D); 66 if (size < 0xFF) DumpByte(size,D);
67 } 67 else
68 else 68 {
69 { 69 DumpByte(0xFF,D);
70 size_t size=s->tsv.len+1; /* include trailing '\0' */ 70 DumpVar(size,D);
71 DumpVar(size,D); 71 }
72 DumpBlock(getstr(s),size*sizeof(char),D); 72 DumpVector(getstr(s),size-1,D); /* no need to save '\0' */
73 } 73 }
74} 74}
75 75