return db;
}
-static struct database *load_database(const char *id,
- struct conf_service *service)
-{
- struct database *db;
-
- db = new_database(id, service->nmem);
-
- db->next = service->databases;
- service->databases = db;
-
- return db;
-}
-
// Return a database structure by ID. Load and add to list if necessary
// new==1 just means we know it's not in the list
-struct database *find_database(const char *id, struct conf_service *service)
+struct database *create_database_for_service(const char *id,
+ struct conf_service *service)
{
struct database *p;
for (p = service->databases; p; p = p->next)
if (!strcmp(p->url, id))
return p;
- return load_database(id, service);
+
+ p = new_database(id, service->nmem);
+
+ p->next = service->databases;
+ service->databases = p;
+
+ return p;
}
// This whole session_grep database thing should be moved elsewhere
struct session_database;
struct session;
struct conf_service;
-struct database *find_database(const char *id, struct conf_service *service);
+struct database *create_database_for_service(const char *id,
+ struct conf_service *service);
int session_grep_databases(struct session *se, const char *filter,
void (*fun)(struct session *se, struct session_database *db));
int predef_grep_databases(void *context, struct conf_service *service,
// This is called from grep_databases -- adds/overrides setting for a target
// This is also where the rules for precedence of settings are implemented
-static void update_database(void *context, struct database *db)
+static void update_database_fun(void *context, struct database *db)
{
struct setting *set = ((struct update_database_context *)
context)->set;
struct update_database_context context;
context.set = set;
context.service = service;
- predef_grep_databases(&context, service, update_database);
+ predef_grep_databases(&context, service, update_database_fun);
}
// This simply copies the 'hard' (application-specific) settings
// If target address is not wildcard, add the database
if (*set->target && !zurl_wildcard(set->target))
- find_database(set->target, service);
+ create_database_for_service(set->target, service);
// Determine if we already have a dictionary entry
if (!strncmp(set->name, "pz:", 3) && (p = strchr(set->name + 3, ':')))