-/* $Id: dba_read.c,v 1.2 2016/08/04 09:33:57 schwarze Exp $ */
+/* $Id: dba_read.c,v 1.5 2020/06/22 19:20:40 schwarze Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
* The interface is defined in "dba.h".
* This file is seperate from dba.c because this also uses "dbm.h".
*/
+#include "config.h"
+
#include <regex.h>
#include <stdint.h>
#include <stdlib.h>
dba = dba_new(npages < 128 ? 128 : npages);
for (ip = 0; ip < npages; ip++) {
pdata = dbm_page_get(ip);
- page = dba_page_new(dba->pages, pdata->name, pdata->sect,
- pdata->arch, pdata->desc, pdata->file + 1, *pdata->file);
- cp = pdata->name;
- while (*(cp = strchr(cp, '\0') + 1) != '\0')
+ page = dba_page_new(dba->pages, pdata->arch,
+ pdata->desc, pdata->file + 1, *pdata->file);
+ for (cp = pdata->name; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_NAME, cp);
- cp = pdata->sect;
- while (*(cp = strchr(cp, '\0') + 1) != '\0')
+ for (cp = pdata->sect; *cp != '\0'; cp = strchr(cp, '\0') + 1)
dba_page_add(page, DBP_SECT, cp);
if ((cp = pdata->arch) != NULL)
while (*(cp = strchr(cp, '\0') + 1) != '\0')