diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-03 19:48:36 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1994-11-03 19:48:36 -0200 |
commit | 852d9a859733ebf7322474c05244105e4f2748a2 (patch) | |
tree | d199091d514625e262cfd8dac109cbfbe31fc457 /table.c | |
parent | 6b18cc9a170c1e3fbfcfe98cb771375ce164d6bf (diff) | |
download | lua-852d9a859733ebf7322474c05244105e4f2748a2.tar.gz lua-852d9a859733ebf7322474c05244105e4f2748a2.tar.bz2 lua-852d9a859733ebf7322474c05244105e4f2748a2.zip |
function 'lua_addfile' returns an error message
Diffstat (limited to 'table.c')
-rw-r--r-- | table.c | 18 |
1 files changed, 6 insertions, 12 deletions
@@ -3,7 +3,7 @@ | |||
3 | ** Module to control static tables | 3 | ** Module to control static tables |
4 | */ | 4 | */ |
5 | 5 | ||
6 | char *rcs_table="$Id: table.c,v 2.7 1994/11/02 19:09:23 roberto Exp roberto $"; | 6 | char *rcs_table="$Id: table.c,v 2.8 1994/11/02 20:29:09 roberto Exp roberto $"; |
7 | 7 | ||
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <string.h> | 9 | #include <string.h> |
@@ -233,21 +233,15 @@ char *lua_createstring (char *s) | |||
233 | /* | 233 | /* |
234 | ** Add a file name at file table, checking overflow. This function also set | 234 | ** Add a file name at file table, checking overflow. This function also set |
235 | ** the external variable "lua_filename" with the function filename set. | 235 | ** the external variable "lua_filename" with the function filename set. |
236 | ** Return 0 on success or 1 on error. | 236 | ** Return 0 on success or error message on error. |
237 | */ | 237 | */ |
238 | int lua_addfile (char *fn) | 238 | char *lua_addfile (char *fn) |
239 | { | 239 | { |
240 | if (lua_nfile >= MAXFILE-1) | 240 | if (lua_nfile >= MAXFILE-1) |
241 | { | 241 | return "too many files"; |
242 | lua_error ("too many files"); | ||
243 | return 1; | ||
244 | } | ||
245 | if ((lua_file[lua_nfile++] = strdup (fn)) == NULL) | 242 | if ((lua_file[lua_nfile++] = strdup (fn)) == NULL) |
246 | { | 243 | return "not enough memory"; |
247 | lua_error ("not enough memory"); | 244 | return NULL; |
248 | return 1; | ||
249 | } | ||
250 | return 0; | ||
251 | } | 245 | } |
252 | 246 | ||
253 | /* | 247 | /* |