@@ -293,7 +293,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
293
293
next_key = §ion->key ;
294
294
prev_key = NULL ;
295
295
296
- if (trace > 1 )
296
+ if (trace ( 2 ) )
297
297
htrc (" New section: '%s'\n " ,section->name );
298
298
299
299
continue ;
@@ -336,7 +336,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
336
336
next_key = &key->next ;
337
337
prev_key = key;
338
338
339
- if (trace > 1 )
339
+ if (trace ( 2 ) )
340
340
htrc (" New key: name='%s', value='%s'\n " ,
341
341
key->name ,key->value ?key->value :" (none)" );
342
342
@@ -359,7 +359,7 @@ static BOOL PROFILE_FlushFile(void)
359
359
FILE *file = NULL ;
360
360
struct stat buf;
361
361
362
- if (trace > 1 )
362
+ if (trace ( 2 ) )
363
363
htrc (" PROFILE_FlushFile: CurProfile=%p\n " , CurProfile);
364
364
365
365
if (!CurProfile) {
@@ -398,7 +398,7 @@ static BOOL PROFILE_FlushFile(void)
398
398
return FALSE ;
399
399
} // endif !file
400
400
401
- if (trace > 1 )
401
+ if (trace ( 2 ) )
402
402
htrc (" Saving '%s'\n " , CurProfile->filename );
403
403
404
404
PROFILE_Save (file, CurProfile->section );
@@ -447,7 +447,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
447
447
struct stat buf;
448
448
PROFILE *tempProfile;
449
449
450
- if (trace > 1 )
450
+ if (trace ( 2 ) )
451
451
htrc (" PROFILE_Open: CurProfile=%p N=%d\n " , CurProfile, N_CACHED_PROFILES);
452
452
453
453
/* First time around */
@@ -468,7 +468,7 @@ static BOOL PROFILE_Open(LPCSTR filename)
468
468
469
469
/* Check for a match */
470
470
for (i = 0 ; i < N_CACHED_PROFILES; i++) {
471
- if (trace > 1 )
471
+ if (trace ( 2 ) )
472
472
htrc (" MRU=%s i=%d\n " , SVP (MRUProfile[i]->filename ), i);
473
473
474
474
if (MRUProfile[i]->filename && !strcmp (filename, MRUProfile[i]->filename )) {
@@ -483,11 +483,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
483
483
} // endif i
484
484
485
485
if (!stat (CurProfile->filename , &buf) && CurProfile->mtime == buf.st_mtime ) {
486
- if (trace > 1 )
486
+ if (trace ( 2 ) )
487
487
htrc (" (%s): already opened (mru=%d)\n " , filename, i);
488
488
489
489
} else {
490
- if (trace > 1 )
490
+ if (trace ( 2 ) )
491
491
htrc (" (%s): already opened, needs refreshing (mru=%d)\n " , filename, i);
492
492
493
493
} // endif stat
@@ -535,11 +535,11 @@ static BOOL PROFILE_Open(LPCSTR filename)
535
535
// strcpy(p, filename);
536
536
// _strlwr(p);
537
537
538
- if (trace > 1 )
538
+ if (trace ( 2 ) )
539
539
htrc (" Opening %s\n " , filename);
540
540
541
541
if ((file = fopen (filename, " r" ))) {
542
- if (trace > 1 )
542
+ if (trace ( 2 ) )
543
543
htrc (" (%s): found it\n " , filename);
544
544
545
545
// CurProfile->unix_name = malloc(strlen(buffer)+1);
@@ -574,12 +574,12 @@ void PROFILE_Close(LPCSTR filename)
574
574
struct stat buf;
575
575
PROFILE *tempProfile;
576
576
577
- if (trace > 1 )
577
+ if (trace ( 2 ) )
578
578
htrc (" PROFILE_Close: CurProfile=%p N=%d\n " , CurProfile, N_CACHED_PROFILES);
579
579
580
580
/* Check for a match */
581
581
for (i = 0 ; i < N_CACHED_PROFILES; i++) {
582
- if (trace > 1 )
582
+ if (trace ( 2 ) )
583
583
htrc (" MRU=%s i=%d\n " , SVP (MRUProfile[i]->filename ), i);
584
584
585
585
if (MRUProfile[i]->filename && !strcmp (filename, MRUProfile[i]->filename )) {
@@ -591,7 +591,7 @@ void PROFILE_Close(LPCSTR filename)
591
591
CurProfile=tempProfile;
592
592
} // endif i
593
593
594
- if (trace > 1 ) {
594
+ if (trace ( 2 ) ) {
595
595
if (!stat (CurProfile->filename , &buf) && CurProfile->mtime == buf.st_mtime )
596
596
htrc (" (%s): already opened (mru=%d)\n " , filename, i);
597
597
else
@@ -620,15 +620,15 @@ void PROFILE_End(void)
620
620
{
621
621
int i;
622
622
623
- if (trace)
623
+ if (trace ( 3 ) )
624
624
htrc (" PROFILE_End: CurProfile=%p N=%d\n " , CurProfile, N_CACHED_PROFILES);
625
625
626
626
if (!CurProfile) // Sergey Vojtovich
627
627
return ;
628
628
629
629
/* Close all opened files and free the cache structure */
630
630
for (i = 0 ; i < N_CACHED_PROFILES; i++) {
631
- if (trace)
631
+ if (trace ( 3 ) )
632
632
htrc (" MRU=%s i=%d\n " , SVP (MRUProfile[i]->filename ), i);
633
633
634
634
// CurProfile = MRUProfile[i]; Sergey Vojtovich
@@ -894,7 +894,7 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
894
894
uint f,l;
895
895
PROFILESECTION *section;
896
896
897
- if (trace > 1 )
897
+ if (trace ( 2 ) )
898
898
htrc (" GetSectionNames: buffer=%p len=%u\n " , buffer, len);
899
899
900
900
if (!buffer || !len)
@@ -909,17 +909,17 @@ static int PROFILE_GetSectionNames(LPSTR buffer, uint len)
909
909
buf = buffer;
910
910
section = CurProfile->section ;
911
911
912
- if (trace > 1 )
912
+ if (trace ( 2 ) )
913
913
htrc (" GetSectionNames: section=%p\n " , section);
914
914
915
915
while (section != NULL ) {
916
- if (trace > 1 )
916
+ if (trace ( 2 ) )
917
917
htrc (" section=%s\n " , section->name );
918
918
919
919
if (section->name [0 ]) {
920
920
l = strlen (section->name ) + 1 ;
921
921
922
- if (trace > 1 )
922
+ if (trace ( 2 ) )
923
923
htrc (" l=%u f=%u\n " , l, f);
924
924
925
925
if (l > f) {
@@ -982,7 +982,7 @@ static int PROFILE_GetString(LPCSTR section, LPCSTR key_name,
982
982
key = PROFILE_Find (&CurProfile->section , section, key_name, FALSE , FALSE );
983
983
PROFILE_CopyEntry (buffer, (key && key->value ) ? key->value : def_val, len, FALSE );
984
984
985
- if (trace > 1 )
985
+ if (trace ( 2 ) )
986
986
htrc (" ('%s','%s','%s'): returning '%s'\n " ,
987
987
section, key_name, def_val, buffer );
988
988
@@ -1010,15 +1010,15 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
1010
1010
LPCSTR value, BOOL create_always)
1011
1011
{
1012
1012
if (!key_name) { /* Delete a whole section */
1013
- if (trace > 1 )
1013
+ if (trace ( 2 ) )
1014
1014
htrc (" Deleting('%s')\n " , section_name);
1015
1015
1016
1016
CurProfile->changed |= PROFILE_DeleteSection (&CurProfile->section ,
1017
1017
section_name);
1018
1018
return TRUE ; /* Even if PROFILE_DeleteSection() has failed,
1019
1019
this is not an error on application's level.*/
1020
1020
} else if (!value) { /* Delete a key */
1021
- if (trace > 1 )
1021
+ if (trace ( 2 ) )
1022
1022
htrc (" Deleting('%s','%s')\n " , section_name, key_name);
1023
1023
1024
1024
CurProfile->changed |= PROFILE_DeleteKey (&CurProfile->section ,
@@ -1027,7 +1027,7 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
1027
1027
} else { /* Set the key value */
1028
1028
PROFILEKEY *key = PROFILE_Find (&CurProfile->section , section_name,
1029
1029
key_name, TRUE , create_always);
1030
- if (trace > 1 )
1030
+ if (trace ( 2 ) )
1031
1031
htrc (" Setting('%s','%s','%s')\n " , section_name, key_name, value);
1032
1032
1033
1033
if (!key)
@@ -1040,17 +1040,17 @@ static BOOL PROFILE_SetString(LPCSTR section_name, LPCSTR key_name,
1040
1040
value++;
1041
1041
1042
1042
if (!strcmp (key->value , value)) {
1043
- if (trace > 1 )
1043
+ if (trace ( 2 ) )
1044
1044
htrc (" no change needed\n " );
1045
1045
1046
1046
return TRUE ; /* No change needed */
1047
1047
} // endif value
1048
1048
1049
- if (trace > 1 )
1049
+ if (trace ( 2 ) )
1050
1050
htrc (" replacing '%s'\n " , key->value );
1051
1051
1052
1052
free (key->value );
1053
- } else if (trace > 1 )
1053
+ } else if (trace ( 2 ) )
1054
1054
htrc (" creating key\n " );
1055
1055
1056
1056
key->value = (char *)malloc (strlen (value) + 1 );
@@ -1345,7 +1345,7 @@ GetPrivateProfileSectionNames(LPSTR buffer, DWORD size, LPCSTR filename)
1345
1345
{
1346
1346
DWORD ret = 0 ;
1347
1347
1348
- if (trace > 1 )
1348
+ if (trace ( 2 ) )
1349
1349
htrc (" GPPSN: filename=%s\n " , filename);
1350
1350
1351
1351
EnterCriticalSection (&PROFILE_CritSect);
0 commit comments