summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-02-24 21:22:12 +0100
committerAki <please@ignore.pl>2021-02-24 21:22:12 +0100
commitd64871855128af6fa41a8c089686552ca1b66c70 (patch)
tree949ee94a4d83eec97ffec681c36ddb13f5b6a3bc
parent0cbe8c24b3f870d91084b3612dba8b4478b64a32 (diff)
downloadplop-d64871855128af6fa41a8c089686552ca1b66c70.zip
plop-d64871855128af6fa41a8c089686552ca1b66c70.tar.gz
plop-d64871855128af6fa41a8c089686552ca1b66c70.tar.bz2
Replaced pushstring with pushliteral where applicable
-rw-r--r--plop.c4
-rw-r--r--response.c6
-rw-r--r--stream.c6
3 files changed, 8 insertions, 8 deletions
diff --git a/plop.c b/plop.c
index 7859e7b..41b9138 100644
--- a/plop.c
+++ b/plop.c
@@ -107,7 +107,7 @@ int plop_make_server(const char * node, const char * service)
int plop_load_handler(lua_State * L, const char * path)
{
lua_getglobal(L, "package");
- lua_pushstring(L, "loaded");
+ lua_pushliteral(L, "loaded");
int result = lua_rawget(L, -2);
if (LUA_TTABLE != result)
@@ -124,7 +124,7 @@ int plop_load_handler(lua_State * L, const char * path)
return result;
}
- lua_pushstring(L, "handler");
+ lua_pushliteral(L, "handler");
lua_pushvalue(L, -2);
lua_rawset(L, -4);
lua_setglobal(L, "handler");
diff --git a/response.c b/response.c
index 8866bd1..4f70b0d 100644
--- a/response.c
+++ b/response.c
@@ -32,7 +32,7 @@ int response_send(lua_State * L, const int fd)
char * buffer = malloc(bytes_total);
char * new_buffer = NULL;
- lua_pushstring(L, "status");
+ lua_pushliteral(L, "status");
lua_gettable(L, -2);
const lua_Integer status = lua_tointeger(L, -1);
lua_pop(L, 1);
@@ -46,7 +46,7 @@ int response_send(lua_State * L, const int fd)
bytes_used = snprintf(buffer, bytes_total, "HTTP/1.1 %d\r\n\r\n", (int) status) - 2;
- lua_pushstring(L, "headers");
+ lua_pushliteral(L, "headers");
lua_gettable(L, -2);
if (0 == lua_istable(L, -1))
@@ -106,7 +106,7 @@ int response_send(lua_State * L, const int fd)
buffer[bytes_used + 1] = '\n';
bytes_used += 2;
- lua_pushstring(L, "data");
+ lua_pushliteral(L, "data");
lua_gettable(L, -2);
size_t data_length = 0;
const char * data = lua_tolstring(L, -1, &data_length);
diff --git a/stream.c b/stream.c
index 8e92358..7700365 100644
--- a/stream.c
+++ b/stream.c
@@ -16,13 +16,13 @@ int stream_push_new(lua_State * L, const int fd)
if (1 == luaL_newmetatable(L, "stream"))
{
- lua_pushstring(L, "__gc");
+ lua_pushliteral(L, "__gc");
lua_pushcfunction(L, stream_gc);
lua_rawset(L, -3);
- lua_pushstring(L, "__index");
+ lua_pushliteral(L, "__index");
lua_createtable(L, 0, 1);
- lua_pushstring(L, "read");
+ lua_pushliteral(L, "read");
lua_pushcfunction(L, stream_read);
lua_rawset(L, -3);
lua_rawset(L, -3);