diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-06 16:05:10 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-05-06 16:05:10 -0300 |
| commit | 71144e3ff0cb81bd9b8bb56d94dc76074c638c64 (patch) | |
| tree | 8098675276d0640684898d4302ea98ae91e2c430 /lstrlib.c | |
| parent | 0dbf0c5953a3d72deebc7e41840a0e73b46de8bc (diff) | |
| download | lua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.tar.gz lua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.tar.bz2 lua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.zip | |
errors `return' int, to avoid warnings
+ home-made `sprintf' (first version)
Diffstat (limited to '')
| -rw-r--r-- | lstrlib.c | 11 |
1 files changed, 5 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.80 2002/04/02 20:41:59 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.81 2002/05/02 17:12:27 roberto Exp roberto $ |
| 3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -170,7 +170,7 @@ typedef struct MatchState { | |||
| 170 | static int check_capture (MatchState *ms, int l) { | 170 | static int check_capture (MatchState *ms, int l) { |
| 171 | l -= '1'; | 171 | l -= '1'; |
| 172 | if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED) | 172 | if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED) |
| 173 | luaL_verror(ms->L, "invalid capture index"); | 173 | return luaL_verror(ms->L, "invalid capture index"); |
| 174 | return l; | 174 | return l; |
| 175 | } | 175 | } |
| 176 | 176 | ||
| @@ -179,8 +179,7 @@ static int capture_to_close (MatchState *ms) { | |||
| 179 | int level = ms->level; | 179 | int level = ms->level; |
| 180 | for (level--; level>=0; level--) | 180 | for (level--; level>=0; level--) |
| 181 | if (ms->capture[level].len == CAP_UNFINISHED) return level; | 181 | if (ms->capture[level].len == CAP_UNFINISHED) return level; |
| 182 | luaL_verror(ms->L, "invalid pattern capture"); | 182 | return luaL_verror(ms->L, "invalid pattern capture"); |
| 183 | return 0; /* to avoid warnings */ | ||
| 184 | } | 183 | } |
| 185 | 184 | ||
| 186 | 185 | ||
| @@ -663,7 +662,7 @@ static int str_format (lua_State *L) { | |||
| 663 | char buff[MAX_ITEM]; /* to store the formatted item */ | 662 | char buff[MAX_ITEM]; /* to store the formatted item */ |
| 664 | int hasprecision = 0; | 663 | int hasprecision = 0; |
| 665 | if (isdigit(uchar(*strfrmt)) && *(strfrmt+1) == '$') | 664 | if (isdigit(uchar(*strfrmt)) && *(strfrmt+1) == '$') |
| 666 | luaL_verror(L, "obsolete `format' option (d$)"); | 665 | return luaL_verror(L, "obsolete `format' option (d$)"); |
| 667 | arg++; | 666 | arg++; |
| 668 | strfrmt = scanformat(L, strfrmt, form, &hasprecision); | 667 | strfrmt = scanformat(L, strfrmt, form, &hasprecision); |
| 669 | switch (*strfrmt++) { | 668 | switch (*strfrmt++) { |
| @@ -696,7 +695,7 @@ static int str_format (lua_State *L) { | |||
| 696 | } | 695 | } |
| 697 | } | 696 | } |
| 698 | default: /* also treat cases `pnLlh' */ | 697 | default: /* also treat cases `pnLlh' */ |
| 699 | luaL_verror(L, "invalid option in `format'"); | 698 | return luaL_verror(L, "invalid option in `format'"); |
| 700 | } | 699 | } |
| 701 | luaL_addlstring(&b, buff, strlen(buff)); | 700 | luaL_addlstring(&b, buff, strlen(buff)); |
| 702 | } | 701 | } |
