Fiddling...

FossilOrigin-Name: 7ac1a6ecafbc849e0510aeccf025ea07d7853f64eb89e87dc19046c8efa36a8c
This commit is contained in:
nekobit 2022-08-26 18:20:54 +00:00
parent e12be1a84b
commit 6e6ca8ad9a
2 changed files with 4 additions and 5 deletions

View File

@ -81,6 +81,7 @@ void render_base_page(struct base_page* page, FCGX_Request* req, struct session*
mXPUSHs(newRV_noinc((SV*)perlify_notifications(notifs, notifs_len)));
}
else ARG_UNDEFINED();
// Run function
PERL_STACK_SCALAR_CALL("base_page");

View File

@ -23,10 +23,9 @@
#include <pthread.h>
// hv_stores(ssn_hv, "id", newSVpv(acct->id, 0));
#define hvstores_str(hv, key, val) hv_stores((hv), key, ((val) ? newSVpv((val), 0) : &PL_sv_undef))
#define hvstores_str(hv, key, val) if (val) { hv_stores((hv), key, newSVpv((val), 0)); }
#define hvstores_int(hv, key, val) hv_stores((hv), key, newSViv((val)))
#define hvstores_ref(hv, key, val) hv_stores((hv), key, \
((val) ? newRV_noinc((SV* const)(val)) : &PL_sv_undef))
#define hvstores_ref(hv, key, val) if (val) { hv_stores((hv), key, newRV_noinc((SV*)(val))); }
/* Seeing all this shit littered in Treebird's code made me decide to write some macros */
#define PERL_STACK_INIT perl_lock(); \
@ -49,9 +48,8 @@
#define PERLIFY_MULTI(type, types, mstype) AV* perlify_##types(const struct mstype* const types, size_t len) { \
if (!(types && len)) return NULL; \
AV* av = newAV(); \
av_extend(av, len-1); \
for (size_t i = 0; i < len; ++i) \
av_store(av, i, newRV_noinc((SV*)perlify_##type(types + i))); \
av_push(av, newRV_noinc((SV*)perlify_##type(types + i))); \
return av; \
}