summaryrefslogtreecommitdiff
path: root/db3x_autobackups/dbsettings.c
diff options
context:
space:
mode:
Diffstat (limited to 'db3x_autobackups/dbsettings.c')
-rw-r--r--db3x_autobackups/dbsettings.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/db3x_autobackups/dbsettings.c b/db3x_autobackups/dbsettings.c
index 503a5eb..f5e6280 100644
--- a/db3x_autobackups/dbsettings.c
+++ b/db3x_autobackups/dbsettings.c
@@ -101,6 +101,7 @@ static char* InsertCachedSetting( const char* szName, size_t cbNameLen, int inde
static char* GetCachedSetting(const char *szModuleName,const char *szSettingName,int settingNameLen)
{
+ static char *lastsetting = NULL;
int moduleNameLen = strlen(szModuleName),index;
char *szFullName = (char*)alloca(moduleNameLen+settingNameLen+3);
@@ -108,10 +109,14 @@ static char* GetCachedSetting(const char *szModuleName,const char *szSettingName
szFullName[moduleNameLen+1]='/';
strcpy(szFullName+moduleNameLen+2,szSettingName);
- if ( li.List_GetIndex(&lSettings, szFullName, &index))
- return((char*)lSettings.items[index] + 1);
+ if (lastsetting && strcmp(szFullName+1,lastsetting) == 0)
+ return lastsetting;
- return InsertCachedSetting( szFullName, moduleNameLen+settingNameLen+3, index )+1;
+ if ( li.List_GetIndex(&lSettings, szFullName, &index))
+ lastsetting = (char*)lSettings.items[index] + 1;
+ else
+ lastsetting = InsertCachedSetting( szFullName, moduleNameLen+settingNameLen+3, index )+1;
+ return lastsetting;
}
static void SetCachedVariant( DBVARIANT* s /* new */, DBVARIANT* d /* cached */ )