-------------------------------------------------------------------------*\ * Incrementally applies smtp stuffing to a string * A, n = dot(l, D) \*-------------------------------------------------------------------------*/
| 832 | * A, n = dot(l, D) |
| 833 | \*-------------------------------------------------------------------------*/ |
| 834 | static int mime_global_dot(lua_State *L) |
| 835 | { |
| 836 | size_t isize = 0, state = (size_t) luaL_checknumber(L, 1); |
| 837 | const char *input = luaL_optlstring(L, 2, NULL, &isize); |
| 838 | const char *last = input + isize; |
| 839 | luaL_Buffer buffer; |
| 840 | /* end-of-input blackhole */ |
| 841 | if (!input) { |
| 842 | lua_pushnil(L); |
| 843 | lua_pushnumber(L, 2); |
| 844 | return 2; |
| 845 | } |
| 846 | /* process all input */ |
| 847 | luaL_buffinit(L, &buffer); |
| 848 | while (input < last) |
| 849 | state = dot(*input++, state, &buffer); |
| 850 | luaL_pushresult(&buffer); |
| 851 | lua_pushnumber(L, (lua_Number) state); |
| 852 | return 2; |
| 853 | } |
| 854 | |
| 855 | EXTENSION_NAMESPACE_END |
nothing calls this directly
no test coverage detected