X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=phpstr%2Fphpstr.h;h=51c2b42b8250ae71de5e5e4d5567a9b7856f4695;hb=4a881fb37338bfeacd40c42a97f334c9faed299a;hp=c53d311f2b532dabb0dcaed462d370f7ee1e1a5d;hpb=1877c25f3174e7ec12dfcfe2797e2454bd9d94eb;p=m6w6%2Fext-http diff --git a/phpstr/phpstr.h b/phpstr/phpstr.h index c53d311..51c2b42 100644 --- a/phpstr/phpstr.h +++ b/phpstr/phpstr.h @@ -4,12 +4,18 @@ #ifndef _PHPSTR_H_ #define _PHPSTR_H_ +#include "php.h" + #ifdef PHP_WIN32 # define PHPSTR_API __declspec(dllexport) #else # define PHPSTR_API #endif +#define PHPSTR(p) ((phpstr *) (p)) +#define PHPSTR_VAL(p) (PHPSTR(p))->data +#define PHPSTR_LEN(p) (PHPSTR(p))->used + #define FREE_PHPSTR_PTR(STR) efree(STR) #define FREE_PHPSTR_VAL(STR) phpstr_dtor(STR) #define FREE_PHPSTR_ALL(STR) phpstr_free(STR) @@ -64,7 +70,7 @@ PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, zend_bool pre_ #define phpstr_from_zval(z) phpstr_from_string(Z_STRVAL(z), Z_STRLEN(z)) #define phpstr_from_zval_ex(b, z) phpstr_from_string_ex(b, Z_STRVAL(z), Z_STRLEN(z)) #define phpstr_from_string(s, l) phpstr_from_string_ex(NULL, (s), (l)) -PHPSTR_API phpstr *phpstr_from_string_ex(phpstr *buf, char *string, size_t length); +PHPSTR_API phpstr *phpstr_from_string_ex(phpstr *buf, const char *string, size_t length); /* usually only called from within the internal functions */ #define phpstr_resize(b, s) phpstr_resize_ex((b), (s), 0)