Skip to content

Commit

Permalink
cleanup misc.c
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaozg committed Apr 5, 2024
1 parent cee5a5d commit 16562a8
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
38 changes: 0 additions & 38 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,41 +307,3 @@ int bin2hex(const unsigned char * src, char *dst, int len)
return i * 2;
}

int openssl_pusherror (lua_State *L, const char *fmt, ...)
{
va_list argp;
va_start(argp, fmt);
luaL_where(L, 1);
lua_pushvfstring(L, fmt, argp);
va_end(argp);
lua_concat(L, 2);
return 1;
}

int openssl_pushargerror (lua_State *L, int arg, const char *extramsg)
{
lua_Debug ar;
const char* name;

if (lua_getstack(L, 0, &ar)) /* have stack frame? */
{
lua_getinfo(L, "n", &ar);
if (strcmp(ar.namewhat, "method") == 0)
{
arg--;
/* do not count 'self' */
if (arg == 0) /* error is in the self argument itself? */
return openssl_pusherror(L, "calling '%s' on bad self (%s)",
ar.name, extramsg);
}
if (ar.name == NULL)
#if defined(COMPAT53_C_) || LUA_VERSION_NUM != 502
name = "?";
#else
name = (compat53_pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?";
#endif
}

return openssl_pusherror(L, "bad argument #%d to '%s' (%s)",
arg, name, extramsg);
}
3 changes: 0 additions & 3 deletions src/private.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,6 @@ int openssl_sk_x509_attribute_totable(lua_State *L, const STACK_OF(X509_ATTRIBUT

X509_ATTRIBUTE* openssl_new_xattribute(lua_State*L, X509_ATTRIBUTE** a, int idx);

int openssl_pusherror (lua_State *L, const char *fmt, ...);
int openssl_pushargerror (lua_State *L, int arg, const char *extramsg);

#ifdef HAVE_USER_CUSTOME
#include HAVE_USER_CUSTOME
#endif
Expand Down

0 comments on commit 16562a8

Please sign in to comment.