Skip to content

Commit

Permalink
cyrusdb.c:cyrusdb_fromname() simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
dilyanpalauzov committed Aug 13, 2023
1 parent ac50025 commit ac7c3f4
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/cyrusdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,16 @@ struct db {

static struct cyrusdb_backend *cyrusdb_fromname(const char *name)
{
int i;
struct cyrusdb_backend *db = NULL;

for (i = 0; _backends[i]; i++) {
for (int i = 0; _backends[i]; i++) {
if (!strcmp(_backends[i]->name, name)) {
db = _backends[i]; break;
return _backends[i];
}
}
if (!db) {
char errbuf[1024];
snprintf(errbuf, sizeof(errbuf),
"cyrusdb backend %s not supported", name);
fatal(errbuf, EX_CONFIG);
}

return db;
char errbuf[1024];
snprintf(errbuf, sizeof(errbuf),
"cyrusdb backend %s not supported", name);
fatal(errbuf, EX_CONFIG);
}

static int _myopen(const char *backend, const char *fname,
Expand Down

0 comments on commit ac7c3f4

Please sign in to comment.