[pacman-dev] [PATCH 4/4] fill in name_hash for assumeinstalled options

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Jul 16 23:05:34 UTC 2015


alpm_depend_t is an exposed data type.  Front-ends may opt for alloc'ing
one and filling the fields manually, but alpm's _alpm_hash_sdbm is not
exposed, making it impossible for them to fill in the name_hash field.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 lib/libalpm/handle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 02af2dc..babd49d 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -590,6 +590,8 @@ int SYMEXPORT alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_
 			RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 	ASSERT((depcpy = _alpm_dep_dup(dep)), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 
+	/* fill in name_hash in case dep was built by hand */
+	depcpy->name_hash = _alpm_hash_sdbm(dep->name);
 	handle->assumeinstalled = alpm_list_add(handle->assumeinstalled, depcpy);
 	return 0;
 }
-- 
2.4.6


More information about the pacman-dev mailing list