summaryrefslogtreecommitdiff
path: root/Zend/zend_string.h
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-08-28 15:41:27 +0200
committerGeorge Peter Banyard <girgias@php.net>2020-08-28 15:41:27 +0200
commitfa8d9b1183f961cb6e0f0ef5a2d1b1d3744fe35b (patch)
treea00044117c3f56969a7b77b466bbdbdd45d66db7 /Zend/zend_string.h
parent7690439edd93bf9dc868cbc34a12fbad6b26e777 (diff)
downloadphp-git-fa8d9b1183f961cb6e0f0ef5a2d1b1d3744fe35b.tar.gz
Improve type declarations for Zend APIs
Voidification of Zend API which always succeeded Use bool argument types instead of int for boolean arguments Use bool return type for functions which return true/false (1/0) Use zend_result return type for functions which return SUCCESS/FAILURE as they don't follow normal boolean semantics Closes GH-6002
Diffstat (limited to 'Zend/zend_string.h')
-rw-r--r--Zend/zend_string.h20
1 files changed, 10 insertions, 10 deletions
diff --git a/Zend/zend_string.h b/Zend/zend_string.h
index 98bd735976..316d022e64 100644
--- a/Zend/zend_string.h
+++ b/Zend/zend_string.h
@@ -25,7 +25,7 @@ BEGIN_EXTERN_C()
typedef void (*zend_string_copy_storage_func_t)(void);
typedef zend_string *(ZEND_FASTCALL *zend_new_interned_string_func_t)(zend_string *str);
-typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, int permanent);
+typedef zend_string *(ZEND_FASTCALL *zend_string_init_interned_func_t)(const char *str, size_t size, bool permanent);
ZEND_API extern zend_new_interned_string_func_t zend_new_interned_string;
ZEND_API extern zend_string_init_interned_func_t zend_string_init_interned;
@@ -136,7 +136,7 @@ static zend_always_inline uint32_t zend_string_delref(zend_string *s)
return 1;
}
-static zend_always_inline zend_string *zend_string_alloc(size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_alloc(size_t len, bool persistent)
{
zend_string *ret = (zend_string *)pemalloc(ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(len)), persistent);
@@ -147,7 +147,7 @@ static zend_always_inline zend_string *zend_string_alloc(size_t len, int persist
return ret;
}
-static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, int persistent)
+static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m, size_t l, bool persistent)
{
zend_string *ret = (zend_string *)safe_pemalloc(n, m, ZEND_MM_ALIGNED_SIZE(_ZSTR_STRUCT_SIZE(l)), persistent);
@@ -158,7 +158,7 @@ static zend_always_inline zend_string *zend_string_safe_alloc(size_t n, size_t m
return ret;
}
-static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_init(const char *str, size_t len, bool persistent)
{
zend_string *ret = zend_string_alloc(len, persistent);
@@ -186,7 +186,7 @@ static zend_always_inline zend_string *zend_string_copy(zend_string *s)
return s;
}
-static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persistent)
+static zend_always_inline zend_string *zend_string_dup(zend_string *s, bool persistent)
{
if (ZSTR_IS_INTERNED(s)) {
return s;
@@ -195,7 +195,7 @@ static zend_always_inline zend_string *zend_string_dup(zend_string *s, int persi
}
}
-static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_t len, bool persistent)
{
zend_string *ret;
@@ -214,7 +214,7 @@ static zend_always_inline zend_string *zend_string_realloc(zend_string *s, size_
return ret;
}
-static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t len, bool persistent)
{
zend_string *ret;
@@ -234,7 +234,7 @@ static zend_always_inline zend_string *zend_string_extend(zend_string *s, size_t
return ret;
}
-static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, int persistent)
+static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size_t len, bool persistent)
{
zend_string *ret;
@@ -254,7 +254,7 @@ static zend_always_inline zend_string *zend_string_truncate(zend_string *s, size
return ret;
}
-static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, int persistent)
+static zend_always_inline zend_string *zend_string_safe_realloc(zend_string *s, size_t n, size_t m, size_t l, bool persistent)
{
zend_string *ret;
@@ -298,7 +298,7 @@ static zend_always_inline void zend_string_release(zend_string *s)
}
}
-static zend_always_inline void zend_string_release_ex(zend_string *s, int persistent)
+static zend_always_inline void zend_string_release_ex(zend_string *s, bool persistent)
{
if (!ZSTR_IS_INTERNED(s)) {
if (GC_DELREF(s) == 0) {