From: Michael Wallner Date: Wed, 28 Nov 2018 07:49:14 +0000 (+0100) Subject: fix returning arrays X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=32cdc02a91cd535ae21e9a775664995f4691a824;p=m6w6%2Fext-psi fix returning arrays --- diff --git a/psi.d/time.psi b/psi.d/time.psi index 716e176..c7f83d1 100644 --- a/psi.d/time.psi +++ b/psi.d/time.psi @@ -124,5 +124,5 @@ function psi\tzset() : void { } function psi\tzname() : array { - return tzname_get() as to_array(tzname_get, 2, to_string(*tzname_get)); + return tzname_get() as to_array(*tzname_get, 2, to_string(*tzname_get)); } diff --git a/src/types/decl_extvar.c b/src/types/decl_extvar.c index 446a28e..24ff39a 100644 --- a/src/types/decl_extvar.c +++ b/src/types/decl_extvar.c @@ -151,7 +151,12 @@ struct psi_decl *psi_decl_extvar_getter(struct psi_decl_extvar *evar) void psi_decl_extvar_get(struct psi_decl_extvar *evar, void *ptr) { - memcpy(ptr, evar->sym, evar->size); + if (evar->arg->var->array_size) { + /* arrays are passed as pointer */ + *(void **) ptr = evar->sym; + } else { + memcpy(ptr, evar->sym, evar->size); + } }