Skip to content

Commit 91aca96

Browse files
committed
ext/standard/filters.c: Use bool type where possible for persistent field/param
1 parent 9cfe9e1 commit 91aca96

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

ext/standard/filters.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ typedef struct _php_conv_base64_encode {
200200
unsigned int line_ccnt;
201201
unsigned int line_len;
202202
int lbchars_dup;
203-
int persistent;
203+
bool persistent;
204204
unsigned char erem[3];
205205
} php_conv_base64_encode;
206206

@@ -226,7 +226,7 @@ static const unsigned char b64_tbl_enc[256] = {
226226
'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
227227
};
228228

229-
static php_conv_err_t php_conv_base64_encode_ctor(php_conv_base64_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent)
229+
static php_conv_err_t php_conv_base64_encode_ctor(php_conv_base64_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, bool persistent)
230230
{
231231
inst->_super.convert_op = (php_conv_convert_func) php_conv_base64_encode_convert;
232232
inst->_super.dtor = (php_conv_dtor_func) php_conv_base64_encode_dtor;
@@ -608,7 +608,7 @@ typedef struct _php_conv_qprint_encode {
608608
unsigned int line_ccnt;
609609
unsigned int line_len;
610610
int lbchars_dup;
611-
int persistent;
611+
bool persistent;
612612
unsigned int lb_ptr;
613613
unsigned int lb_cnt;
614614
} php_conv_qprint_encode;
@@ -825,7 +825,7 @@ static php_conv_err_t php_conv_qprint_encode_convert(php_conv_qprint_encode *ins
825825
#undef NEXT_CHAR
826826
#undef CONSUME_CHAR
827827

828-
static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int opts, int persistent)
828+
static php_conv_err_t php_conv_qprint_encode_ctor(php_conv_qprint_encode *inst, unsigned int line_len, const char *lbchars, size_t lbchars_len, int lbchars_dup, int opts, bool persistent)
829829
{
830830
if (line_len < 4 && lbchars != NULL) {
831831
return PHP_CONV_ERR_TOO_BIG;
@@ -857,7 +857,7 @@ typedef struct _php_conv_qprint_decode {
857857
int scan_stat;
858858
unsigned int next_char;
859859
int lbchars_dup;
860-
int persistent;
860+
bool persistent;
861861
unsigned int lb_ptr;
862862
unsigned int lb_cnt;
863863
} php_conv_qprint_decode;
@@ -1039,7 +1039,7 @@ static php_conv_err_t php_conv_qprint_decode_convert(php_conv_qprint_decode *ins
10391039

10401040
return err;
10411041
}
1042-
static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, int persistent)
1042+
static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst, const char *lbchars, size_t lbchars_len, int lbchars_dup, bool persistent)
10431043
{
10441044
inst->_super.convert_op = (php_conv_convert_func) php_conv_qprint_decode_convert;
10451045
inst->_super.dtor = (php_conv_dtor_func) php_conv_qprint_decode_dtor;
@@ -1061,7 +1061,7 @@ static php_conv_err_t php_conv_qprint_decode_ctor(php_conv_qprint_decode *inst,
10611061

10621062
typedef struct _php_convert_filter {
10631063
php_conv *cd;
1064-
int persistent;
1064+
bool persistent;
10651065
char *filtername;
10661066
char stub[128];
10671067
size_t stub_len;
@@ -1072,7 +1072,7 @@ typedef struct _php_convert_filter {
10721072
#define PHP_CONV_QPRINT_ENCODE 3
10731073
#define PHP_CONV_QPRINT_DECODE 4
10741074

1075-
static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pretval, size_t *pretval_len, char *field_name, size_t field_name_len, int persistent)
1075+
static php_conv_err_t php_conv_get_string_prop_ex(const HashTable *ht, char **pretval, size_t *pretval_len, char *field_name, size_t field_name_len, bool persistent)
10761076
{
10771077
zval *tmpval;
10781078

@@ -1149,7 +1149,7 @@ static php_conv_err_t php_conv_get_uint_prop_ex(const HashTable *ht, unsigned in
11491149
#define GET_BOOL_PROP(ht, var, fldname) \
11501150
php_conv_get_bool_prop_ex(ht, &var, fldname, sizeof(fldname))
11511151

1152-
static php_conv *php_conv_open(int conv_mode, const HashTable *options, int persistent)
1152+
static php_conv *php_conv_open(int conv_mode, const HashTable *options, bool persistent)
11531153
{
11541154
/* FIXME: I'll have to replace this ugly code by something neat
11551155
(factories?) in the near future. */
@@ -1281,7 +1281,7 @@ static php_conv *php_conv_open(int conv_mode, const HashTable *options, int pers
12811281

12821282
static zend_result php_convert_filter_ctor(php_convert_filter *inst,
12831283
int conv_mode, HashTable *conv_opts,
1284-
const char *filtername, int persistent)
1284+
const char *filtername, bool persistent)
12851285
{
12861286
inst->persistent = persistent;
12871287
inst->filtername = pestrdup(filtername, persistent);
@@ -1315,7 +1315,7 @@ static zend_result strfilter_convert_append_bucket(
13151315
php_stream *stream, php_stream_filter *filter,
13161316
php_stream_bucket_brigade *buckets_out,
13171317
const char *ps, size_t buf_len, size_t *consumed,
1318-
int persistent)
1318+
bool persistent)
13191319
{
13201320
php_conv_err_t err;
13211321
php_stream_bucket *new_bucket;
@@ -1607,7 +1607,7 @@ static const php_stream_filter_factory strfilter_convert_factory = {
16071607
typedef struct _php_consumed_filter_data {
16081608
size_t consumed;
16091609
zend_off_t offset;
1610-
uint8_t persistent;
1610+
bool persistent;
16111611
} php_consumed_filter_data;
16121612

16131613
static php_stream_filter_status_t consumed_filter_filter(
@@ -1698,7 +1698,7 @@ typedef enum _php_chunked_filter_state {
16981698
typedef struct _php_chunked_filter_data {
16991699
size_t chunk_size;
17001700
php_chunked_filter_state state;
1701-
int persistent;
1701+
bool persistent;
17021702
} php_chunked_filter_data;
17031703

17041704
static size_t php_dechunk(char *buf, size_t len, php_chunked_filter_data *data)

0 commit comments

Comments
 (0)