diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-04-26 14:36:42 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-04-26 14:36:42 +0000 |
commit | f191d6468b3fc555b28d5a67924ec6ea623f9940 (patch) | |
tree | 26933b99e855591ebab95477bbb2ea3e7d2cba71 | |
parent | 2e5816eef646b4454412dcdeb8e02b674bb81e0b (diff) |
sync with build 0.7 #24
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@158 4f64403b-2f21-0410-a795-97e2b3489a10
-rw-r--r-- | db3x_autobackups/dbsettings.c | 11 |
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 */ )
|