X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=phpstr%2Fphpstr.h;h=259cab2b9def7feb619d6519dae51070a0bb3540;hb=001d038560e304bef20f3b3cea063653a45e3a61;hp=ac58c1d320f95c974080a693a24dfbce75a2561d;hpb=8164d4e998a79ef48c50f118adffca5c33799875;p=m6w6%2Fext-http diff --git a/phpstr/phpstr.h b/phpstr/phpstr.h index ac58c1d..259cab2 100644 --- a/phpstr/phpstr.h +++ b/phpstr/phpstr.h @@ -10,6 +10,8 @@ # define PHPSTR_DEFAULT_SIZE 256 #endif +#define PHPSTR_NOMEM ((size_t) -1) + #ifndef STR_SET # define STR_SET(STR, SET) \ { \ @@ -105,8 +107,8 @@ PHPSTR_API phpstr *phpstr_init_ex(phpstr *buf, size_t chunk_size, int flags); 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) -PHPSTR_API size_t phpstr_resize_ex(phpstr *buf, size_t len, size_t override_size); +#define phpstr_resize(b, s) phpstr_resize_ex((b), (s), 0, 0) +PHPSTR_API size_t phpstr_resize_ex(phpstr *buf, size_t len, size_t override_size, int allow_error); /* shrink memory chunk to actually used size (+1) */ PHPSTR_API size_t phpstr_shrink(phpstr *buf);