lua: rename LuaReturnStringBuffer to LuaPushStringBuffer

LuaPushStringBuffer is a wrapper for lua_pushlstring, so the new name
better reflects it's function.
pull/1112/head
Victor Julien 11 years ago
parent 0e93a29274
commit 90b5aff02e

@ -63,7 +63,7 @@ int LuaCallbackError(lua_State *luastate, const char *msg)
return 2;
}
int LuaReturnStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len)
int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len)
{
/* we're using a buffer sized at a multiple of 4 as lua_pushlstring generates
* invalid read errors in valgrind otherwise. Adding in a nul to be sure.
@ -114,7 +114,7 @@ void LogLuaPushTableKeyValueString(lua_State *luastate, const char *key, const c
void LogLuaPushTableKeyValueArray(lua_State *luastate, const char *key, const uint8_t *value, size_t len)
{
lua_pushstring(luastate, key);
LuaReturnStringBuffer(luastate, value, len);
LuaPushStringBuffer(luastate, value, len);
lua_settable(luastate, -3);
}
@ -543,7 +543,7 @@ static int LuaCallbackLogPath(lua_State *luastate)
if (ld == NULL)
return LuaCallbackError(luastate, "internal error: no log dir");
return LuaReturnStringBuffer(luastate, (const uint8_t *)ld, strlen(ld));
return LuaPushStringBuffer(luastate, (const uint8_t *)ld, strlen(ld));
}
static int LuaCallbackLogDebug(lua_State *luastate)

@ -27,7 +27,7 @@
#ifdef HAVE_LUA
int LuaCallbackError(lua_State *luastate, const char *msg);
int LuaReturnStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len);
int LuaPushStringBuffer(lua_State *luastate, const uint8_t *input, size_t input_len);
const char *LuaGetStringArgument(lua_State *luastate, int argc);
void LogLuaPushTableKeyValueInt(lua_State *luastate, const char *key, int value);

@ -88,7 +88,7 @@ static int HttpGetRequestHost(lua_State *luastate)
if (tx->request_hostname == NULL)
return LuaCallbackError(luastate, "no request hostname");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(tx->request_hostname), bstr_len(tx->request_hostname));
}
@ -104,7 +104,7 @@ static int HttpGetRequestUriRaw(lua_State *luastate)
if (tx->request_uri == NULL)
return LuaCallbackError(luastate, "no request uri");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(tx->request_uri), bstr_len(tx->request_uri));
}
@ -126,7 +126,7 @@ static int HttpGetRequestUriNormalized(lua_State *luastate)
bstr_len(htud->request_uri_normalized) == 0)
return LuaCallbackError(luastate, "no normalized uri");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(htud->request_uri_normalized),
bstr_len(htud->request_uri_normalized));
}
@ -143,7 +143,7 @@ static int HttpGetRequestLine(lua_State *luastate)
if (tx->request_line == NULL)
return LuaCallbackError(luastate, "no request_line");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(tx->request_line), bstr_len(tx->request_line));
}
@ -159,7 +159,7 @@ static int HttpGetResponseLine(lua_State *luastate)
if (tx->response_line == NULL)
return LuaCallbackError(luastate, "no response_line");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(tx->response_line), bstr_len(tx->response_line));
}
@ -186,7 +186,7 @@ static int HttpGetHeader(lua_State *luastate, int dir)
if (h == NULL || bstr_len(h->value) == 0)
return LuaCallbackError(luastate, "header not found");
return LuaReturnStringBuffer(luastate,
return LuaPushStringBuffer(luastate,
bstr_ptr(h->value), bstr_len(h->value));
}
@ -223,7 +223,7 @@ static int HttpGetRawHeaders(lua_State *luastate, int dir)
if (raw == NULL || raw_len == 0)
return LuaCallbackError(luastate, "no raw headers");
return LuaReturnStringBuffer(luastate, raw, raw_len);
return LuaPushStringBuffer(luastate, raw, raw_len);
}
static int HttpGetRawRequestHeaders(lua_State *luastate)
@ -258,8 +258,8 @@ static int HttpGetHeaders(lua_State *luastate, int dir)
size_t no_of_headers = htp_table_size(table);
for (; i < no_of_headers; i++) {
h = htp_table_get_index(table, i, NULL);
LuaReturnStringBuffer(luastate, bstr_ptr(h->name), bstr_len(h->name));
LuaReturnStringBuffer(luastate, bstr_ptr(h->value), bstr_len(h->value));
LuaPushStringBuffer(luastate, bstr_ptr(h->name), bstr_len(h->name));
LuaPushStringBuffer(luastate, bstr_ptr(h->value), bstr_len(h->value));
lua_settable(luastate, -3);
}
return 1;
@ -305,7 +305,7 @@ static int HttpGetBody(lua_State *luastate, int dir)
lua_newtable(luastate);
while (chunk != NULL) {
lua_pushinteger(luastate, index);
LuaReturnStringBuffer(luastate, chunk->data, chunk->len);
LuaPushStringBuffer(luastate, chunk->data, chunk->len);
lua_settable(luastate, -3);
chunk = chunk->next;

Loading…
Cancel
Save