@@ -413,7 +413,7 @@ static int inifile_copy_to(inifile *dba, size_t pos_start, size_t pos_end, inifi
413
413
/* {{{ inifile_filter
414
414
* copy from to dba while ignoring key name (group must equal)
415
415
*/
416
- static int inifile_filter (inifile * dba , inifile * from , const key_type * key TSRMLS_DC )
416
+ static int inifile_filter (inifile * dba , inifile * from , const key_type * key , zend_bool * found TSRMLS_DC )
417
417
{
418
418
size_t pos_start = 0 , pos_next = 0 , pos_curr ;
419
419
int ret = SUCCESS ;
@@ -424,6 +424,9 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
424
424
while (inifile_read (from , & ln TSRMLS_CC )) {
425
425
switch (inifile_key_cmp (& ln .key , key TSRMLS_CC )) {
426
426
case 0 :
427
+ if (found ) {
428
+ * found = (zend_bool ) 1 ;
429
+ }
427
430
pos_curr = php_stream_tell (from -> fp );
428
431
if (pos_start != pos_next ) {
429
432
php_stream_seek (from -> fp , pos_start , SEEK_SET );
@@ -458,7 +461,7 @@ static int inifile_filter(inifile *dba, inifile *from, const key_type *key TSRML
458
461
459
462
/* {{{ inifile_delete_replace_append
460
463
*/
461
- static int inifile_delete_replace_append (inifile * dba , const key_type * key , const val_type * value , int append TSRMLS_DC )
464
+ static int inifile_delete_replace_append (inifile * dba , const key_type * key , const val_type * value , int append , zend_bool * found TSRMLS_DC )
462
465
{
463
466
size_t pos_grp_start = 0 , pos_grp_next ;
464
467
inifile * ini_tmp = NULL ;
@@ -516,7 +519,7 @@ static int inifile_delete_replace_append(inifile *dba, const key_type *key, cons
516
519
if (key -> name && strlen (key -> name )) {
517
520
/* 6 */
518
521
if (!append && ini_tmp ) {
519
- ret = inifile_filter (dba , ini_tmp , key TSRMLS_CC );
522
+ ret = inifile_filter (dba , ini_tmp , key , found TSRMLS_CC );
520
523
}
521
524
522
525
/* 7 */
@@ -563,23 +566,39 @@ static int inifile_delete_replace_append(inifile *dba, const key_type *key, cons
563
566
*/
564
567
int inifile_delete (inifile * dba , const key_type * key TSRMLS_DC )
565
568
{
566
- return inifile_delete_replace_append (dba , key , NULL , 0 TSRMLS_CC );
569
+ return inifile_delete_replace_append (dba , key , NULL , 0 , NULL TSRMLS_CC );
570
+ }
571
+ /* }}} */
572
+
573
+ /* {{{ inifile_delete_ex
574
+ */
575
+ int inifile_delete_ex (inifile * dba , const key_type * key , zend_bool * found TSRMLS_DC )
576
+ {
577
+ return inifile_delete_replace_append (dba , key , NULL , 0 , found TSRMLS_CC );
567
578
}
568
579
/* }}} */
569
580
570
581
/* {{{ inifile_relace
571
582
*/
572
583
int inifile_replace (inifile * dba , const key_type * key , const val_type * value TSRMLS_DC )
573
584
{
574
- return inifile_delete_replace_append (dba , key , value , 0 TSRMLS_CC );
585
+ return inifile_delete_replace_append (dba , key , value , 0 , NULL TSRMLS_CC );
586
+ }
587
+ /* }}} */
588
+
589
+ /* {{{ inifile_replace_ex
590
+ */
591
+ int inifile_replace_ex (inifile * dba , const key_type * key , const val_type * value , zend_bool * found TSRMLS_DC )
592
+ {
593
+ return inifile_delete_replace_append (dba , key , value , 0 , found TSRMLS_CC );
575
594
}
576
595
/* }}} */
577
596
578
597
/* {{{ inifile_append
579
598
*/
580
599
int inifile_append (inifile * dba , const key_type * key , const val_type * value TSRMLS_DC )
581
600
{
582
- return inifile_delete_replace_append (dba , key , value , 1 TSRMLS_CC );
601
+ return inifile_delete_replace_append (dba , key , value , 1 , NULL TSRMLS_CC );
583
602
}
584
603
/* }}} */
585
604
0 commit comments