Skip to content

Commit 395d018

Browse files
committed
sapi: use zend_result type for return types when possible
1 parent 25159e0 commit 395d018

2 files changed

Lines changed: 18 additions & 19 deletions

File tree

main/SAPI.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_
646646
}
647647
}
648648

649-
SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
649+
SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg)
650650
{
651651
sapi_header_struct sapi_header;
652652
char *colon_offset;
@@ -830,10 +830,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
830830
}
831831

832832

833-
SAPI_API int sapi_send_headers(void)
833+
SAPI_API zend_result sapi_send_headers(void)
834834
{
835835
int retval;
836-
int ret = FAILURE;
836+
zend_result ret = FAILURE;
837837

838838
if (SG(headers_sent) || SG(request_info).no_headers) {
839839
return SUCCESS;
@@ -919,7 +919,7 @@ SAPI_API int sapi_send_headers(void)
919919
}
920920

921921

922-
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
922+
SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entries)
923923
{
924924
const sapi_post_entry *p=post_entries;
925925

@@ -933,16 +933,15 @@ SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
933933
}
934934

935935

936-
SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry)
936+
SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry)
937937
{
938-
int ret;
939938
zend_string *key;
940939
if (SG(sapi_started) && EG(current_execute_data)) {
941940
return FAILURE;
942941
}
943942
key = zend_string_init(post_entry->content_type, post_entry->content_type_len, 1);
944943
GC_MAKE_PERSISTENT_LOCAL(key);
945-
ret = zend_hash_add_mem(&SG(known_post_content_types), key,
944+
zend_result ret = zend_hash_add_mem(&SG(known_post_content_types), key,
946945
(void *) post_entry, sizeof(sapi_post_entry)) ? SUCCESS : FAILURE;
947946
zend_string_release_ex(key, 1);
948947
return ret;
@@ -958,7 +957,7 @@ SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry)
958957
}
959958

960959

961-
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void))
960+
SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void))
962961
{
963962
if (SG(sapi_started) && EG(current_execute_data)) {
964963
return FAILURE;
@@ -968,7 +967,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void)
968967
}
969968

970969

971-
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
970+
SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
972971
{
973972
if (SG(sapi_started) && EG(current_execute_data)) {
974973
return FAILURE;
@@ -977,7 +976,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva
977976
return SUCCESS;
978977
}
979978

980-
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
979+
SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
981980
{
982981
if (SG(sapi_started) && EG(current_execute_data)) {
983982
return FAILURE;
@@ -987,7 +986,7 @@ SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, co
987986
return SUCCESS;
988987
}
989988

990-
SAPI_API int sapi_flush(void)
989+
SAPI_API zend_result sapi_flush(void)
991990
{
992991
if (sapi_module.flush) {
993992
sapi_module.flush(SG(server_context));

main/SAPI.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,25 +198,25 @@ typedef enum { /* Parameter: */
198198
} sapi_header_op_enum;
199199

200200
BEGIN_EXTERN_C()
201-
SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg);
201+
SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg);
202202

203203
SAPI_API int sapi_add_header_ex(const char *header_line, size_t header_line_len, bool duplicate, bool replace);
204204
#define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1)
205205

206206

207-
SAPI_API int sapi_send_headers(void);
207+
SAPI_API zend_result sapi_send_headers(void);
208208
SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
209209
SAPI_API void sapi_handle_post(void *arg);
210210
SAPI_API void sapi_read_post_data(void);
211211
SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen);
212-
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entry);
213-
SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry);
212+
SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entry);
213+
SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry);
214214
SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry);
215-
SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void));
216-
SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
217-
SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
215+
SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void));
216+
SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
217+
SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
218218

219-
SAPI_API int sapi_flush(void);
219+
SAPI_API zend_result sapi_flush(void);
220220
SAPI_API zend_stat_t *sapi_get_stat(void);
221221
SAPI_API char *sapi_getenv(const char *name, size_t name_len);
222222

0 commit comments

Comments
 (0)