| 90 | |
| 91 | |
| 92 | static int getnum (lua_State *L, const char **fmt, int df) { |
| 93 | if (!isdigit(**fmt)) /* no number? */ |
| 94 | return df; /* return default value */ |
| 95 | else { |
| 96 | int a = 0; |
| 97 | do { |
| 98 | if (a > (INT_MAX / 10) || a * 10 > (INT_MAX - (**fmt - '0'))) |
| 99 | luaL_error(L, "integral size overflow"); |
| 100 | a = a*10 + *((*fmt)++) - '0'; |
| 101 | } while (isdigit(**fmt)); |
| 102 | return a; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | |
| 107 | #define defaultoptions(h) ((h)->endian = native.endian, (h)->align = 1) |
no test coverage detected