Naming cleanups.

SVN revision: 37767
This commit is contained in:
Kim Woelders 2008-11-23 14:34:14 +00:00
parent a8fe074f46
commit cabaddbca1
1 changed files with 21 additions and 23 deletions

View File

@ -40,8 +40,6 @@ typedef struct {
ECfgFileItem *pitms; ECfgFileItem *pitms;
} ECfgFile; } ECfgFile;
#define E_DB_File ECfgFile
static ECfgFile * static ECfgFile *
e16_db_open(const char *name) e16_db_open(const char *name)
{ {
@ -216,7 +214,7 @@ e16_db_str_set(ECfgFile * ecf, const char *key, const char *value)
*/ */
static void static void
CfgItemLoad(E_DB_File * edf, const char *prefix, const CfgItem * ci) CfgItemLoad(ECfgFile * ecf, const char *prefix, const CfgItem * ci)
{ {
char buf[1024]; char buf[1024];
const char *name = buf; const char *name = buf;
@ -238,30 +236,30 @@ CfgItemLoad(E_DB_File * edf, const char *prefix, const CfgItem * ci)
switch (ci->type) switch (ci->type)
{ {
case ITEM_TYPE_BOOL: case ITEM_TYPE_BOOL:
if (!edf || !e16_db_int_get(edf, name, &my_int)) if (!ecf || !e16_db_int_get(ecf, name, &my_int))
my_int = (ci->dflt) ? 1 : 0; my_int = (ci->dflt) ? 1 : 0;
*((char *)ci->ptr) = my_int; *((char *)ci->ptr) = my_int;
break; break;
case ITEM_TYPE_INT: case ITEM_TYPE_INT:
case ITEM_TYPE_HEX: case ITEM_TYPE_HEX:
if (!edf || !e16_db_int_get(edf, name, &my_int)) if (!ecf || !e16_db_int_get(ecf, name, &my_int))
my_int = ci->dflt; my_int = ci->dflt;
*((int *)ci->ptr) = my_int; *((int *)ci->ptr) = my_int;
break; break;
case ITEM_TYPE_FLOAT: case ITEM_TYPE_FLOAT:
if (!edf || !e16_db_float_get(edf, name, &my_float)) if (!ecf || !e16_db_float_get(ecf, name, &my_float))
my_float = ci->dflt; my_float = ci->dflt;
*((float *)ci->ptr) = my_float; *((float *)ci->ptr) = my_float;
break; break;
case ITEM_TYPE_STRING: case ITEM_TYPE_STRING:
s = (edf) ? e16_db_str_get(edf, name) : NULL; s = (ecf) ? e16_db_str_get(ecf, name) : NULL;
*((char **)ci->ptr) = s; *((char **)ci->ptr) = s;
break; break;
} }
} }
static void static void
CfgItemSave(E_DB_File * edf, const char *prefix, const CfgItem * ci) CfgItemSave(ECfgFile * ecf, const char *prefix, const CfgItem * ci)
{ {
char buf[1024]; char buf[1024];
const char *name = buf; const char *name = buf;
@ -281,20 +279,20 @@ CfgItemSave(E_DB_File * edf, const char *prefix, const CfgItem * ci)
switch (ci->type) switch (ci->type)
{ {
case ITEM_TYPE_BOOL: case ITEM_TYPE_BOOL:
e16_db_int_set(edf, name, *((char *)ci->ptr)); e16_db_int_set(ecf, name, *((char *)ci->ptr));
break; break;
case ITEM_TYPE_INT: case ITEM_TYPE_INT:
e16_db_int_set(edf, name, *((int *)ci->ptr)); e16_db_int_set(ecf, name, *((int *)ci->ptr));
break; break;
case ITEM_TYPE_HEX: case ITEM_TYPE_HEX:
e16_db_hex_set(edf, name, *((unsigned int *)ci->ptr)); e16_db_hex_set(ecf, name, *((unsigned int *)ci->ptr));
break; break;
case ITEM_TYPE_FLOAT: case ITEM_TYPE_FLOAT:
e16_db_float_set(edf, name, *((float *)ci->ptr)); e16_db_float_set(ecf, name, *((float *)ci->ptr));
break; break;
case ITEM_TYPE_STRING: case ITEM_TYPE_STRING:
s = *(char **)(ci->ptr); s = *(char **)(ci->ptr);
e16_db_str_set(edf, name, s); e16_db_str_set(ecf, name, s);
break; break;
} }
} }
@ -313,14 +311,14 @@ ConfigurationLoad(void)
const EModule **pml, *pm; const EModule **pml, *pm;
const CfgItem *pcl; const CfgItem *pcl;
char buf[4096]; char buf[4096];
E_DB_File *edf; ECfgFile *ecf;
if (EDebug(EDBUG_TYPE_CONFIG)) if (EDebug(EDBUG_TYPE_CONFIG))
Eprintf("ConfigurationLoad\n"); Eprintf("ConfigurationLoad\n");
memset(&Conf, 0, sizeof(EConf)); memset(&Conf, 0, sizeof(EConf));
edf = e16_db_open_read(ConfigurationGetFile(buf, sizeof(buf))); ecf = e16_db_open_read(ConfigurationGetFile(buf, sizeof(buf)));
/* NB! We have to assign the defaults even if it doesn't exist */ /* NB! We have to assign the defaults even if it doesn't exist */
/* Load module configs */ /* Load module configs */
@ -331,12 +329,12 @@ ConfigurationLoad(void)
ncl = pm->cfg.num; ncl = pm->cfg.num;
pcl = pm->cfg.lst; pcl = pm->cfg.lst;
for (j = 0; j < ncl; j++) for (j = 0; j < ncl; j++)
CfgItemLoad(edf, pm->name, pcl + j); CfgItemLoad(ecf, pm->name, pcl + j);
} }
ModuleListFree(pml); ModuleListFree(pml);
if (edf) if (ecf)
e16_db_close(edf); e16_db_close(ecf);
} }
void void
@ -346,13 +344,13 @@ ConfigurationSave(void)
const EModule **pml, *pm; const EModule **pml, *pm;
const CfgItem *pcl; const CfgItem *pcl;
char buf[4096]; char buf[4096];
E_DB_File *edf; ECfgFile *ecf;
if (EDebug(EDBUG_TYPE_CONFIG)) if (EDebug(EDBUG_TYPE_CONFIG))
Eprintf("ConfigurationSave\n"); Eprintf("ConfigurationSave\n");
edf = e16_db_open(ConfigurationGetFile(buf, sizeof(buf))); ecf = e16_db_open(ConfigurationGetFile(buf, sizeof(buf)));
if (edf == NULL) if (ecf == NULL)
return; return;
/* Load module configs */ /* Load module configs */
@ -363,11 +361,11 @@ ConfigurationSave(void)
ncl = pm->cfg.num; ncl = pm->cfg.num;
pcl = pm->cfg.lst; pcl = pm->cfg.lst;
for (j = 0; j < ncl; j++) for (j = 0; j < ncl; j++)
CfgItemSave(edf, pm->name, pcl + j); CfgItemSave(ecf, pm->name, pcl + j);
} }
ModuleListFree(pml); ModuleListFree(pml);
e16_db_close(edf); e16_db_close(ecf);
e16_db_flush(); e16_db_flush();
} }