MCPcopy Create free account
hub / github.com/Tencent/UnLua / eolprocess

Function eolprocess

Plugins/UnLuaExtensions/LuaSocket/Source/src/mime.cpp:763–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

761\*-------------------------------------------------------------------------*/
762#define eolcandidate(c) (c == '\r' || c == '\n')
763static int eolprocess(int c, int last, const char *marker,
764 luaL_Buffer *buffer)
765{
766 if (eolcandidate(c)) {
767 if (eolcandidate(last)) {
768 if (c == last) luaL_addstring(buffer, marker);
769 return 0;
770 } else {
771 luaL_addstring(buffer, marker);
772 return c;
773 }
774 } else {
775 luaL_addchar(buffer, (char) c);
776 return 0;
777 }
778}
779
780/*-------------------------------------------------------------------------*\
781* Converts a string to uniform EOL convention.

Callers 1

mime_global_eolFunction · 0.85

Calls 1

luaL_addstringFunction · 0.85

Tested by

no test coverage detected