X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=phpstr%2Fphpstr.h;h=3a4f88b4794c32d6e402ba2c181bba5ff71495f1;hp=6844dd2590a99190b3ba96f4350ac80021efb50c;hb=1df42dae0279a4d0f98b042bb389e90cbd197f6f;hpb=aca5a5a21e4514707a71cfa69cc19ae50a78f5d3;ds=sidebyside diff --git a/phpstr/phpstr.h b/phpstr/phpstr.h index 6844dd2..3a4f88b 100644 --- a/phpstr/phpstr.h +++ b/phpstr/phpstr.h @@ -4,8 +4,6 @@ #ifndef _PHPSTR_H_ #define _PHPSTR_H_ -#include "php.h" - #ifndef PHPSTR_DEFAULT_SIZE # define PHPSTR_DEFAULT_SIZE 256 #endif @@ -41,8 +39,15 @@ #ifndef pemalloc # define pemalloc(s,p) malloc(s) # define pefree(x,p) free(x) -# define perealloc(x,s,p) erealloc(x,s) +# define perealloc(x,s,p) realloc(x,s) # define perealloc_recoverable perealloc +# define ecalloc calloc +static inline void *estrndup(void *p, size_t s) +{ + char *r = (char *) malloc(s+1); + if (r) memcpy((void *) r, p, s), r[s] = '\0'; + return (void *) r; +} #endif #if defined(PHP_WIN32)