| 100 | |
| 101 | |
| 102 | static int str_upper (lua_State *L) { |
| 103 | size_t l; |
| 104 | size_t i; |
| 105 | luaL_Buffer b; |
| 106 | const char *s = luaL_checklstring(L, 1, &l); |
| 107 | char *p = luaL_buffinitsize(L, &b, l); |
| 108 | for (i=0; i<l; i++) |
| 109 | p[i] = toupper(uchar(s[i])); |
| 110 | luaL_pushresultsize(&b, l); |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | |
| 115 | /* reasonable limit to avoid arithmetic overflow */ |
nothing calls this directly
no test coverage detected