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 | |
parent | 6b18cc9a170c1e3fbfcfe98cb771375ce164d6bf (diff) | |
download | lua-852d9a859733ebf7322474c05244105e4f2748a2.tar.gz lua-852d9a859733ebf7322474c05244105e4f2748a2.tar.bz2 lua-852d9a859733ebf7322474c05244105e4f2748a2.zip |
function 'lua_addfile' returns an error message
-rw-r--r-- | table.c | 18 | ||||
-rw-r--r-- | table.h | 4 |
2 files changed, 8 insertions, 14 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 | /* |
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | ** Module to control static tables | 2 | ** Module to control static tables |
3 | ** TeCGraf - PUC-Rio | 3 | ** TeCGraf - PUC-Rio |
4 | ** $Id: table.h,v 2.2 1994/07/19 21:27:18 celes Exp $ | 4 | ** $Id: table.h,v 2.3 1994/10/17 19:03:23 celes Exp roberto $ |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #ifndef table_h | 7 | #ifndef table_h |
@@ -25,7 +25,7 @@ void lua_travsymbol (void (*fn)(Object *)); | |||
25 | void lua_markobject (Object *o); | 25 | void lua_markobject (Object *o); |
26 | void lua_pack (void); | 26 | void lua_pack (void); |
27 | char *lua_createstring (char *s); | 27 | char *lua_createstring (char *s); |
28 | int lua_addfile (char *fn); | 28 | char *lua_addfile (char *fn); |
29 | int lua_delfile (void); | 29 | int lua_delfile (void); |
30 | char *lua_filename (void); | 30 | char *lua_filename (void); |
31 | void lua_nextvar (void); | 31 | void lua_nextvar (void); |