From 058acaa9f2d52a4854650d19964bb7892c99d9af Mon Sep 17 00:00:00 2001 From: Mark Pulford Date: Tue, 26 Apr 2011 11:45:29 +0930 Subject: Update lua_json pcall API naming convention --- lua_json.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lua_json.c') diff --git a/lua_json.c b/lua_json.c index 3c9803c..77a8d90 100644 --- a/lua_json.c +++ b/lua_json.c @@ -262,9 +262,10 @@ char *lua_json_encode(lua_State *l, int *len) return json; } -/* lua_c_json_encode(object) must be called via lua_pcall(). - * It can be used to catch any encoder exceptions */ -int lua_c_json_encode(lua_State *l) +/* lua_json_pcall_encode(object) must be called via lua_pcall(). + * This allows a C caller to catch any errors without needing + * to register the string with Lua for garbage collection. */ +int lua_json_pcall_encode(lua_State *l) { char *json; int len; @@ -666,8 +667,10 @@ void lua_json_decode(lua_State *l, const char *json_text) strbuf_free(json.tmp); } -/* lua_c_json_decode(string) must be called from C with lua_pcall() */ -int lua_c_json_decode(lua_State *l) +/* lua_json_pcall_decode(string) must be called via lua_pcall(). + * This allows a C caller to catch any errors so the string can + * be freed before returning to Lua. */ +int lua_json_pcall_decode(lua_State *l) { const char *json; -- cgit v1.2.3-55-g6feb