diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-27 15:33:22 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-12-27 15:33:22 -0200 |
commit | acdb0b741e31adebfa4f608f8bf23e65fa68d741 (patch) | |
tree | a4f3bb695c4b2ae03ef8e02d15953bc12de25a9d /lauxlib.c | |
parent | 5b08fcd5a1392a7440cae91e68f350a44b136806 (diff) | |
download | lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.gz lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.tar.bz2 lua-acdb0b741e31adebfa4f608f8bf23e65fa68d741.zip |
comments.
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.21 1999/11/22 13:12:07 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.22 1999/12/20 13:09:45 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -9,7 +9,7 @@ | |||
9 | #include <stdio.h> | 9 | #include <stdio.h> |
10 | #include <string.h> | 10 | #include <string.h> |
11 | 11 | ||
12 | /* Please Notice: This file uses only the official API of Lua | 12 | /* This file uses only the official API of Lua. |
13 | ** Any function declared here could be written as an application function. | 13 | ** Any function declared here could be written as an application function. |
14 | ** With care, these functions can be used by other libraries. | 14 | ** With care, these functions can be used by other libraries. |
15 | */ | 15 | */ |
@@ -113,7 +113,7 @@ void luaL_verror (lua_State *L, const char *fmt, ...) { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | 115 | ||
116 | #define EXTRALEN 13 /* > strlen('string "..."\0') */ | 116 | #define EXTRALEN sizeof("string \"...\"0") |
117 | 117 | ||
118 | void luaL_chunkid (char *out, const char *source, int len) { | 118 | void luaL_chunkid (char *out, const char *source, int len) { |
119 | if (*source == '(') { | 119 | if (*source == '(') { |
@@ -129,7 +129,7 @@ void luaL_chunkid (char *out, const char *source, int len) { | |||
129 | const char *b = strchr(source , '\n'); /* stop at first new line */ | 129 | const char *b = strchr(source , '\n'); /* stop at first new line */ |
130 | int lim = (b && (b-source)<len) ? b-source : len; | 130 | int lim = (b && (b-source)<len) ? b-source : len; |
131 | sprintf(out, "string \"%.*s\"", lim, source); | 131 | sprintf(out, "string \"%.*s\"", lim, source); |
132 | strcpy(out+lim+(EXTRALEN-5), "...\""); /* 5 = strlen("...'\0") */ | 132 | strcpy(out+lim+(EXTRALEN-sizeof("...\"0")), "...\""); |
133 | } | 133 | } |
134 | } | 134 | } |
135 | } | 135 | } |