summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-09-23 21:50:09 +0100
committerColin Watson <cjwatson@debian.org>2022-09-23 21:50:09 +0100
commit4cbb67968dd3db7f0140ca50489683c892cd5a10 (patch)
tree67aa7d429a349f969ac08dfda9139ff0ff041ab1
parentbb0f7086ba4ce4503761737bf612088c03b6c495 (diff)
Remove infoalloc macro
It doesn't really pull its weight. * libdb/db_lookup.c (dblookup, dblookup_pattern): Call `XZALLOC (struct mandata)` rather than `infoalloc ()`. * src/man.c (try_section, do_global_apropos_section): Likewise. * libdb/db_storage.h (infoalloc): Remove.
-rw-r--r--libdb/db_lookup.c6
-rw-r--r--libdb/db_storage.h5
-rw-r--r--src/man.c4
3 files changed, 5 insertions, 10 deletions
diff --git a/libdb/db_lookup.c b/libdb/db_lookup.c
index 66541d83..40bb9427 100644
--- a/libdb/db_lookup.c
+++ b/libdb/db_lookup.c
@@ -312,7 +312,7 @@ static gl_list_t dblookup (MYDBM_FILE dbf, const char *page,
else if (*MYDBM_DPTR (cont) != '\t') { /* Just one entry */
bool matches = false;
- info = infoalloc ();
+ info = XZALLOC (struct mandata);
split_content (dbf, MYDBM_DPTR (cont), info);
if (!info->name)
info->name = xstrdup (page);
@@ -379,7 +379,7 @@ static gl_list_t dblookup (MYDBM_FILE dbf, const char *page,
MYDBM_FREE_DPTR (key);
/* Allocate info struct and add it to the list. */
- info = infoalloc ();
+ info = XZALLOC (struct mandata);
split_content (dbf, MYDBM_DPTR (multi_cont), info);
if (!info->name)
info->name = xstrdup (ref->name);
@@ -509,7 +509,7 @@ gl_list_t dblookup_pattern (MYDBM_FILE dbf, const char *pattern,
if (!got_match)
goto nextpage_tab;
- tail = infoalloc ();
+ tail = XZALLOC (struct mandata);
memcpy (tail, &info, sizeof (info));
info.name = NULL; /* steal memory */
MYDBM_SET_DPTR (cont, NULL); /* == info.addr */
diff --git a/libdb/db_storage.h b/libdb/db_storage.h
index 87afe802..5d585b11 100644
--- a/libdb/db_storage.h
+++ b/libdb/db_storage.h
@@ -49,8 +49,6 @@
#include "timespec.h"
-#include "xalloc.h"
-
#include "mydbm.h"
struct mandata {
@@ -99,9 +97,6 @@ extern void gripe_lock (const char *filename);
extern void gripe_corrupt_data (MYDBM_FILE dbf);
extern datum make_multi_key (const char *page, const char *ext);
-/* allocate a mandata structure */
-#define infoalloc() XZALLOC (struct mandata)
-
extern char *name_to_key (const char *name);
bool name_ext_equals (const void *elt1, const void *elt2);
int name_ext_compare (const void *elt1, const void *elt2);
diff --git a/src/man.c b/src/man.c
index 5ee291fe..7f0d7bce 100644
--- a/src/man.c
+++ b/src/man.c
@@ -3159,7 +3159,7 @@ static int try_section (const char *path, const char *sec, const char *name,
order_files (path, &names);
GL_LIST_FOREACH (names, found_name) {
- struct mandata *info = infoalloc ();
+ struct mandata *info = XZALLOC (struct mandata);
char *info_buffer = filename_info (found_name, info, name);
const char *ult;
int f;
@@ -3737,7 +3737,7 @@ static int do_global_apropos_section (const char *path, const char *sec,
if (!grep (found_name, name, &search))
continue;
- info = infoalloc ();
+ info = XZALLOC (struct mandata);
info_buffer = filename_info (found_name, info, NULL);
if (!info_buffer)
goto next;