** Get a conversion specification and copy it to 'form'. ** Return the address of its last character. */
| 1243 | ** Return the address of its last character. |
| 1244 | */ |
| 1245 | static const char *getformat (lua_State *L, const char *strfrmt, |
| 1246 | char *form) { |
| 1247 | /* spans flags, width, and precision ('0' is included as a flag) */ |
| 1248 | size_t len = strspn(strfrmt, L_FMTFLAGSF "123456789."); |
| 1249 | len++; /* adds following character (should be the specifier) */ |
| 1250 | /* still needs space for '%', '\0', plus a length modifier */ |
| 1251 | if (len >= MAX_FORMAT - 10) |
| 1252 | luaL_error(L, "invalid format (too long)"); |
| 1253 | *(form++) = '%'; |
| 1254 | memcpy(form, strfrmt, len * sizeof(char)); |
| 1255 | *(form + len) = '\0'; |
| 1256 | return strfrmt + len - 1; |
| 1257 | } |
| 1258 | |
| 1259 | |
| 1260 | /* |
no test coverage detected