| 258 | |
| 259 | |
| 260 | static const char *checkoption (lua_State *L, const char *conv, |
| 261 | ptrdiff_t convlen, char *buff) { |
| 262 | const char *option = LUA_STRFTIMEOPTIONS; |
| 263 | int oplen = 1; /* length of options being checked */ |
| 264 | for (; *option != '\0' && oplen <= convlen; option += oplen) { |
| 265 | if (*option == '|') /* next block? */ |
| 266 | oplen++; /* will check options with next length (+1) */ |
| 267 | else if (memcmp(conv, option, oplen) == 0) { /* match? */ |
| 268 | memcpy(buff, conv, oplen); /* copy valid option to buffer */ |
| 269 | buff[oplen] = '\0'; |
| 270 | return conv + oplen; /* return next item */ |
| 271 | } |
| 272 | } |
| 273 | luaL_argerror(L, 1, |
| 274 | lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); |
| 275 | return conv; /* to avoid warnings */ |
| 276 | } |
| 277 | |
| 278 | |
| 279 | /* maximum size for an individual 'strftime' item */ |
no test coverage detected