X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fdata.h;h=37658cc1f1794c82c94c38aeda74745e9e45441c;hp=ca7bf9089f8b1488d22b826451800de81945d419;hb=fb8f7887c289ae74d6e8dd85d55ae09e6796e890;hpb=a0f437f26cd0f121ee911a55327a68a3544bf15f diff --git a/src/data.h b/src/data.h index ca7bf90..37658cc 100644 --- a/src/data.h +++ b/src/data.h @@ -31,8 +31,6 @@ #include "plist.h" #include "validate.h" -#include "php_network.h" - #include #include @@ -46,6 +44,14 @@ # define RTLD_DEFAULT ((void *) 0) #endif +#if PSI_THREADED_PARSER +zend_string *psi_string_init_interned(const char *buf, size_t len, int p); +zend_string *psi_new_interned_string(zend_string *str); +#else +# define psi_string_init_interned zend_string_init_interned +# define psi_new_interned_string zend_new_interned_string +#endif + static inline void *psi_dlsym(struct psi_plist *dllist, const char *name, const char *redir) { void *dl, *sym = NULL; @@ -92,12 +98,20 @@ union psi_dump_arg { void *hn; int fd; }; -typedef void (*psi_dump_cb)(union psi_dump_arg, const char *msg, ...); +typedef int (*psi_dump_cb)(union psi_dump_arg, const char *msg, ...); struct psi_dump { union psi_dump_arg ctx; psi_dump_cb fun; }; -#define PSI_DUMP(dump, ...) (dump)->fun((dump)->ctx, __VA_ARGS__) +#define PSI_DUMP(dump, ...) do { \ + struct psi_dump _dump_tmp, *_dump_ptr = dump; \ + if (!_dump_ptr) { \ + _dump_ptr = &_dump_tmp; \ + _dump_tmp.ctx.fd = STDOUT_FILENO; \ + _dump_tmp.fun = (psi_dump_cb) dprintf; \ + } \ + _dump_ptr->fun(_dump_ptr->ctx, __VA_ARGS__); \ +} while(0) #define PSI_DATA(D) ((struct psi_data *) (D))