diff options
author | daurnimator <quae@daurnimator.com> | 2018-05-31 15:42:38 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-07-09 15:59:19 +1000 |
commit | 1693be544f512327cad06babf670dfdd62715120 (patch) | |
tree | 43b5f719719914edadad57a1834e60919cdfb586 | |
parent | 567af0f77efde046e0eb7b03a3262605844993d1 (diff) | |
download | luaossl-1693be544f512327cad06babf670dfdd62715120.tar.gz luaossl-1693be544f512327cad06babf670dfdd62715120.tar.bz2 luaossl-1693be544f512327cad06babf670dfdd62715120.zip |
src/openssl.c: Use lua_pushliteral where possible
-rw-r--r-- | src/openssl.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/openssl.c b/src/openssl.c index 1aa0206..be301b7 100644 --- a/src/openssl.c +++ b/src/openssl.c @@ -1338,7 +1338,7 @@ static const char *auxL_pusherror(lua_State *L, int error, const char *fun) { char txt[256]; if (!ERR_peek_error()) - return lua_pushstring(L, "oops: no OpenSSL errors set"); + return lua_pushliteral(L, "oops: no OpenSSL errors set"); code = ERR_get_error_line(&path, &line); @@ -3988,7 +3988,7 @@ static int pk_toPEM(lua_State *L) { long len; if (1 == (top = lua_gettop(L))) { - lua_pushstring(L, "publickey"); + lua_pushliteral(L, "publickey"); ++top; } @@ -4496,7 +4496,7 @@ static int pk_getParameters(lua_State *L) { * Use special "{" parameter to tell loop to push table. * Subsequent parameters will be assigned as fields. */ - lua_pushstring(L, "{"); + lua_pushliteral(L, "{"); luaL_checkstack(L, nopts, "too many arguments"); for (optname = optlist; *optname; optname++) { lua_pushstring(L, *optname); @@ -5277,17 +5277,17 @@ static int gn__next(lua_State *L) { switch (name->type) { case GEN_EMAIL: - lua_pushstring(L, "email"); + lua_pushliteral(L, "email"); GN_PUSHSTRING(L, name->d.rfc822Name); break; case GEN_URI: - lua_pushstring(L, "URI"); + lua_pushliteral(L, "URI"); GN_PUSHSTRING(L, name->d.uniformResourceIdentifier); break; case GEN_DNS: - lua_pushstring(L, "DNS"); + lua_pushliteral(L, "DNS"); GN_PUSHSTRING(L, name->d.dNSName); break; @@ -5313,14 +5313,12 @@ static int gn__next(lua_State *L) { if (!(txt = inet_ntop(af, &ip, buf, sizeof buf))) continue; - len = strlen(txt); - - lua_pushstring(L, "IP"); - lua_pushlstring(L, txt, len); + lua_pushliteral(L, "IP"); + lua_pushstring(L, txt); break; case GEN_DIRNAME: - lua_pushstring(L, "DirName"); + lua_pushliteral(L, "DirName"); xn_dup(L, name->d.dirn); break; |