summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2015-10-27 00:47:30 -0400
committerAllan McRae <allan@archlinux.org>2015-10-27 19:38:32 +1000
commitb46bdeea146b19f026b2bb2ad4d281aa89fff777 (patch)
tree3e8c3f2cbd09e16f45f925caec00407fcb0cd94f /lib/libalpm
parent3c671270180163798cb0d08ea163e7100ab21ee6 (diff)
downloadpacman-b46bdeea146b19f026b2bb2ad4d281aa89fff777.tar.xz
order hooks by file name
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/hook.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libalpm/hook.c b/lib/libalpm/hook.c
index fe4b2041..c7b4ee87 100644
--- a/lib/libalpm/hook.c
+++ b/lib/libalpm/hook.c
@@ -363,6 +363,11 @@ static int _alpm_hook_triggered(alpm_handle_t *handle, struct _alpm_hook_t *hook
return 0;
}
+static int _alpm_hook_cmp(struct _alpm_hook_t *h1, struct _alpm_hook_t *h2)
+{
+ return strcmp(h1->name, h2->name);
+}
+
static alpm_list_t *find_hook(alpm_list_t *haystack, const void *needle)
{
while(haystack) {
@@ -478,6 +483,9 @@ int _alpm_hook_run(alpm_handle_t *handle, enum _alpm_hook_when_t when)
closedir(d);
}
+ hooks = alpm_list_msort(hooks, alpm_list_count(hooks),
+ (alpm_list_fn_cmp)_alpm_hook_cmp);
+
for(i = hooks; i; i = i->next) {
struct _alpm_hook_t *hook = i->data;
if(hook && hook->when == when && _alpm_hook_triggered(handle, hook)) {