diff options
author | Colin Watson <cjwatson@debian.org> | 2022-09-23 23:18:37 +0100 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-09-23 23:18:37 +0100 |
commit | 9054530236905b1b203b4ac86568793fec527146 (patch) | |
tree | 57de0191b37a96443bb2456436a79cec0b021e0e /libdb | |
parent | fdf2f3db554c777cf40d7e26b947f33a67b67b46 (diff) |
Simplify the filename_info interface
This interface is a bit less confusing.
* libdb/db_lookup.c (free_mandata_elements, free_mandata_struct): Move
to ...
* lib/filenames.c (free_mandata_elements, free_mandata_struct): ...
here.
* libdb/db_storage.h (free_mandata_elements, free_mandata_struct): Move
to ...
* lib/filenames.h (free_mandata_elements, free_mandata_struct): ...
here.
* lib/filenames.c (filename_info): Return a `struct mandata` with the
`addr` element set to the buffer containing the fields, rather than
returning the buffer and taking a pointer to a `struct mandata` as a
parameter. Update all callers.
* lib/filenames.h (filename_info): Update prototype.
Diffstat (limited to 'libdb')
-rw-r--r-- | libdb/db_lookup.c | 21 | ||||
-rw-r--r-- | libdb/db_storage.h | 2 |
2 files changed, 0 insertions, 23 deletions
diff --git a/libdb/db_lookup.c b/libdb/db_lookup.c index 4606d984..98e77611 100644 --- a/libdb/db_lookup.c +++ b/libdb/db_lookup.c @@ -144,27 +144,6 @@ datum make_multi_key (const char *page, const char *ext) return key; } -/* Free allocated elements of a mandata structure, but not the structure - * itself. - */ -void free_mandata_elements (struct mandata *pinfo) -{ - if (pinfo->addr) - /* TODO: this memory appears to be properly owned by the - * caller; why do we free it here? - */ - free (pinfo->addr); /* free the 'content' */ - free (pinfo->name); /* free the real name */ -} - -/* Free a mandata structure and its elements. */ -void free_mandata_struct (struct mandata *pinfo) -{ - if (pinfo) - free_mandata_elements (pinfo); - free (pinfo); -} - /* Get the key that should be used for a given name. The caller is * responsible for freeing the return value. */ diff --git a/libdb/db_storage.h b/libdb/db_storage.h index 47f82ac9..00e2c6bf 100644 --- a/libdb/db_storage.h +++ b/libdb/db_storage.h @@ -67,8 +67,6 @@ extern gl_list_t dblookup_pattern (MYDBM_FILE dbf, const char *page, extern int dbstore (MYDBM_FILE dbf, struct mandata *in, const char *base); extern int dbdelete (MYDBM_FILE dbf, const char *name, struct mandata *in); extern void dbprintf (const struct mandata *info); -extern void free_mandata_elements (struct mandata *pinfo); -extern void free_mandata_struct (struct mandata *pinfo); extern void split_content (MYDBM_FILE dbf, char *cont_ptr, struct mandata *pinfo); extern int compare_ids (char a, char b, int promote_links); |