diff options
Diffstat (limited to 'lstrlib.c')
-rw-r--r-- | lstrlib.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -1071,7 +1071,10 @@ static int lua_number2strx (lua_State *L, char *buff, int sz, | |||
1071 | 1071 | ||
1072 | 1072 | ||
1073 | /* valid flags in a format specification */ | 1073 | /* valid flags in a format specification */ |
1074 | #define FLAGS "-+ #0" | 1074 | #if !defined(L_FMTFLAGS) |
1075 | #define L_FMTFLAGS "-+ #0" | ||
1076 | #endif | ||
1077 | |||
1075 | 1078 | ||
1076 | /* | 1079 | /* |
1077 | ** maximum size of each format specification (such as "%-099.99d") | 1080 | ** maximum size of each format specification (such as "%-099.99d") |
@@ -1169,8 +1172,8 @@ static void addliteral (lua_State *L, luaL_Buffer *b, int arg) { | |||
1169 | 1172 | ||
1170 | static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { | 1173 | static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { |
1171 | const char *p = strfrmt; | 1174 | const char *p = strfrmt; |
1172 | while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ | 1175 | while (*p != '\0' && strchr(L_FMTFLAGS, *p) != NULL) p++; /* skip flags */ |
1173 | if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) | 1176 | if ((size_t)(p - strfrmt) >= sizeof(L_FMTFLAGS)/sizeof(char)) |
1174 | luaL_error(L, "invalid format (repeated flags)"); | 1177 | luaL_error(L, "invalid format (repeated flags)"); |
1175 | if (isdigit(uchar(*p))) p++; /* skip width */ | 1178 | if (isdigit(uchar(*p))) p++; /* skip width */ |
1176 | if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ | 1179 | if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ |