From: Michael Wallner Date: Wed, 18 Nov 2015 17:22:57 +0000 (+0100) Subject: fix retval X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=commitdiff_plain;h=2d013b4e72d2c803817441fa13cadcac357df276 fix retval --- diff --git a/psis/time.psi b/psis/time.psi index e491185..1281c51 100644 --- a/psis/time.psi +++ b/psis/time.psi @@ -1,3 +1,9 @@ +extern time_t time(time_t *t); +function psi\time() : int { + let t = NULL; + return to_int(time); +} + extern int gettimeofday(struct timeval *tv, struct timezone *tz); function psi\gettimeofday(array &$tv = NULL, array &$tz = NULL) : int { let tv = calloc(1, struct timeval); diff --git a/src/libjit.c b/src/libjit.c index 4866809..736b54d 100644 --- a/src/libjit.c +++ b/src/libjit.c @@ -11,9 +11,6 @@ static inline jit_abi_t psi_jit_abi(const char *convention) { } static inline jit_type_t psi_jit_token_type(token_t t) { switch (t) { - default: - ZEND_ASSERT(0); - /* no break */ case PSI_T_VOID: return jit_type_void; case PSI_T_INT8: @@ -34,12 +31,11 @@ static inline jit_type_t psi_jit_token_type(token_t t) { return jit_type_ulong; case PSI_T_BOOL: return jit_type_sys_bool; - case PSI_T_INT: - return jit_type_sys_int; case PSI_T_FLOAT: return jit_type_sys_float; case PSI_T_DOUBLE: return jit_type_sys_double; + EMPTY_SWITCH_DEFAULT_CASE(); } } static inline jit_type_t psi_jit_decl_type(decl_type *type) { diff --git a/src/module.c b/src/module.c index 8ab22ae..b7a09c3 100644 --- a/src/module.c +++ b/src/module.c @@ -685,6 +685,7 @@ void psi_call(zend_execute_data *execute_data, zval *return_value, impl *impl) } } + memset(&ret_val, 0, sizeof(ret_val)); PSI_ContextCall(&PSI_G(context), &ret_val, impl->decl); psi_do_return(return_value, impl->stmts->ret.list[0], &ret_val);