|
|
|
|
|
|
|
|
{ |
|
|
{ |
|
|
gint r, top; |
|
|
gint r, top; |
|
|
const gchar *str = NULL; |
|
|
const gchar *str = NULL; |
|
|
|
|
|
gboolean converted_to_str = FALSE; |
|
|
|
|
|
|
|
|
top = lua_gettop (L); |
|
|
top = lua_gettop (L); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
str = lua_tostring (L, -1); |
|
|
str = lua_tostring (L, -1); |
|
|
|
|
|
|
|
|
|
|
|
if (str) { |
|
|
|
|
|
converted_to_str = TRUE; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
lua_pushstring (L, "class"); |
|
|
lua_pushstring (L, "class"); |
|
|
|
|
|
|
|
|
str = lua_tostring (L, -1); |
|
|
str = lua_tostring (L, -1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
r = rspamd_snprintf (outbuf, len + 1, "%s(%p)", str, lua_touserdata (L, pos)); |
|
|
|
|
|
|
|
|
if (converted_to_str) { |
|
|
|
|
|
r = rspamd_snprintf (outbuf, len + 1, "%s", str); |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
/* Print raw pointer */ |
|
|
|
|
|
r = rspamd_snprintf (outbuf, len + 1, "%s(%p)", str, lua_touserdata (L, pos)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
lua_settop (L, top); |
|
|
lua_settop (L, top); |
|
|
|
|
|
|
|
|
return r; |
|
|
return r; |