MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / addquoted

Function addquoted

Source/Misc/lua/src/lua.c:14373–14400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14371
14372
14373static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
14374size_t l;
14375const char *s = luaL_checklstring(L, arg, &l);
14376luaL_addchar(b, '"');
14377while (l--) {
14378switch (*s) {
14379case '"': case '\\': case '\n': {
14380luaL_addchar(b, '\\');
14381luaL_addchar(b, *s);
14382break;
14383}
14384case '\r': {
14385luaL_addlstring(b, "\\r", 2);
14386break;
14387}
14388case '\0': {
14389luaL_addlstring(b, "\\000", 4);
14390break;
14391}
14392default: {
14393luaL_addchar(b, *s);
14394break;
14395}
14396}
14397s++;
14398}
14399luaL_addchar(b, '"');
14400}
14401
14402static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
14403const char *p = strfrmt;

Callers 1

str_formatFunction · 0.85

Calls 2

luaL_checklstringFunction · 0.85
luaL_addlstringFunction · 0.85

Tested by

no test coverage detected