#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)
#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)
PHPSTR_API phpstr *phpstr_sub(const phpstr *buf, size_t offset, size_t len);
/* remove a substring */
-PHPSTR_API ssize_t phpstr_cut(phpstr *buf, size_t offset, size_t length);
+PHPSTR_API size_t phpstr_cut(phpstr *buf, size_t offset, size_t length);
/* get a complete phpstr duplicate */
PHPSTR_API phpstr *phpstr_dup(const phpstr *buf);