Skip to content

Commit 9659d7f

Browse files
committed
session: Use true / false instead of 1 / 0 for bool parameters
Changes done with Coccinelle: @r1@ identifier F; identifier p; typedef bool; parameter list [n1] PL1; parameter list [n2] PL2; @@ F(PL1, bool p, PL2) { ... } @r2@ identifier r1.F; expression list [r1.n1] EL1; expression list [r1.n2] EL2; @@ F(EL1, ( - 1 + true | - 0 + false ) , EL2)
1 parent 8e66b4e commit 9659d7f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

ext/session/mod_mm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static zend_result ps_mm_key_exists(ps_mm *data, const zend_string *key)
207207
if (!key) {
208208
return FAILURE;
209209
}
210-
sd = ps_sd_lookup(data, key, 0);
210+
sd = ps_sd_lookup(data, key, false);
211211
if (sd) {
212212
return SUCCESS;
213213
}
@@ -365,7 +365,7 @@ PS_READ_FUNC(mm)
365365
PS(session_status) = php_session_active;
366366
}
367367

368-
sd = ps_sd_lookup(data, PS(id), 0);
368+
sd = ps_sd_lookup(data, PS(id), false);
369369
if (sd) {
370370
*val = zend_string_init(sd->data, sd->datalen, 0);
371371
ret = SUCCESS;
@@ -383,7 +383,7 @@ PS_WRITE_FUNC(mm)
383383

384384
mm_lock(data->mm, MM_LOCK_RW);
385385

386-
sd = ps_sd_lookup(data, key, 1);
386+
sd = ps_sd_lookup(data, key, true);
387387
if (!sd) {
388388
sd = ps_sd_new(data, key);
389389
ps_mm_debug(("new entry for %s\n", ZSTR_VAL(key)));
@@ -422,7 +422,7 @@ PS_DESTROY_FUNC(mm)
422422

423423
mm_lock(data->mm, MM_LOCK_RW);
424424

425-
sd = ps_sd_lookup(data, key, 0);
425+
sd = ps_sd_lookup(data, key, false);
426426
if (sd) {
427427
ps_sd_destroy(data, sd);
428428
}

ext/session/session.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ static zend_result php_session_initialize(void)
487487
}
488488

489489
/* GC must be done after read */
490-
php_session_gc(0);
490+
php_session_gc(false);
491491

492492
if (PS(session_vars)) {
493493
zend_string_release_ex(PS(session_vars), 0);
@@ -2741,7 +2741,7 @@ PHP_FUNCTION(session_gc)
27412741
RETURN_FALSE;
27422742
}
27432743

2744-
num = php_session_gc(1);
2744+
num = php_session_gc(true);
27452745
if (num < 0) {
27462746
RETURN_FALSE;
27472747
}
@@ -3247,7 +3247,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
32473247

32483248
progress->post_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->data), ZEND_STRL("bytes_processed"));
32493249

3250-
php_rinit_session(0);
3250+
php_rinit_session(false);
32513251
PS(id) = zend_string_copy(Z_STR(progress->sid));
32523252
if (progress->apply_trans_sid) {
32533253
/* Enable trans sid by modifying flags */
@@ -3274,7 +3274,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
32743274
progress->current_file_bytes_processed = zend_hash_str_find(Z_ARRVAL(progress->current_file), ZEND_STRL("bytes_processed"));
32753275

32763276
Z_LVAL_P(progress->current_file_bytes_processed) = data->post_bytes_processed;
3277-
php_session_rfc1867_update(progress, 0);
3277+
php_session_rfc1867_update(progress, false);
32783278
}
32793279
break;
32803280
case MULTIPART_EVENT_FILE_DATA: {
@@ -3287,7 +3287,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
32873287
Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length;
32883288
Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
32893289

3290-
php_session_rfc1867_update(progress, 0);
3290+
php_session_rfc1867_update(progress, false);
32913291
}
32923292
break;
32933293
case MULTIPART_EVENT_FILE_END: {
@@ -3306,7 +3306,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
33063306

33073307
Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
33083308

3309-
php_session_rfc1867_update(progress, 0);
3309+
php_session_rfc1867_update(progress, false);
33103310
}
33113311
break;
33123312
case MULTIPART_EVENT_END: {
@@ -3320,7 +3320,7 @@ static zend_result php_session_rfc1867_callback(unsigned int event, void *event_
33203320
SEPARATE_ARRAY(&progress->data);
33213321
add_assoc_bool_ex(&progress->data, ZEND_STRL("done"), 1);
33223322
Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed;
3323-
php_session_rfc1867_update(progress, 1);
3323+
php_session_rfc1867_update(progress, true);
33243324
}
33253325
}
33263326
php_rshutdown_session_globals();

0 commit comments

Comments
 (0)