X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fimpl_var.h;fp=src%2Ftypes%2Fimpl_var.h;h=2a179adcc6f4c845103572c8e97e61a5800c3d03;hp=762f421cde68d37f730a03216475a342cab81e23;hb=2fa436074ca9a5e87f39b696de832fa2188fcfc6;hpb=d57dd73ddbd960613cfc06bc4c9473b71d3598ef diff --git a/src/types/impl_var.h b/src/types/impl_var.h index 762f421..2a179ad 100644 --- a/src/types/impl_var.h +++ b/src/types/impl_var.h @@ -33,40 +33,16 @@ struct psi_validate_scope; struct psi_impl_var { struct psi_token *token; - char *name, *fqn; + zend_string *name, *fqn; struct psi_impl_arg *arg; unsigned reference:1; }; -struct psi_impl_var *psi_impl_var_init(const char *name, bool is_reference); +struct psi_impl_var *psi_impl_var_init(zend_string *name, bool is_reference); struct psi_impl_var *psi_impl_var_copy(struct psi_impl_var *var); void psi_impl_var_free(struct psi_impl_var **var_ptr); void psi_impl_var_dump(int fd, struct psi_impl_var *var, bool vararg); -#include - -static inline char *psi_impl_var_name_prepend(char *current, const char *prepend) { - size_t c_len = strlen(current); - size_t p_len = strlen(prepend); - - current = realloc(current, p_len - + c_len // includes '$' - + 1 // connecting dot - + 1 // terminating 0 - ); - if (current) { - if (c_len > 1) { - memmove(current + p_len + 1 + 1, current + 1, c_len - 1 + 1); - current[p_len + 1] = '.'; - } else { - /* just '$' */ - current[p_len + 1] = '\0'; - } - memcpy(current + 1, prepend, p_len); - } - return current; -} - bool psi_impl_var_validate(struct psi_data *data, struct psi_impl_var *ivar, struct psi_validate_scope *scope);