Selaa lähdekoodia

[Minor] Do not print pointer if successfully converted UD to a string

tags/1.7.8
Vsevolod Stakhov 5 vuotta sitten
vanhempi
commit
b37be54bd8
1 muutettua tiedostoa jossa 13 lisäystä ja 1 poistoa
  1. 13
    1
      src/lua/lua_logger.c

+ 13
- 1
src/lua/lua_logger.c Näytä tiedosto

{ {
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;

Loading…
Peruuta
Tallenna