1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-21 23:38:49 -05:00

order hooks by file name

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Andrew Gregory 2015-10-27 00:47:30 -04:00 committed by Allan McRae
parent 3c67127018
commit b46bdeea14

View File

@ -363,6 +363,11 @@ static int _alpm_hook_triggered(alpm_handle_t *handle, struct _alpm_hook_t *hook
return 0; 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) static alpm_list_t *find_hook(alpm_list_t *haystack, const void *needle)
{ {
while(haystack) { while(haystack) {
@ -478,6 +483,9 @@ int _alpm_hook_run(alpm_handle_t *handle, enum _alpm_hook_when_t when)
closedir(d); 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) { for(i = hooks; i; i = i->next) {
struct _alpm_hook_t *hook = i->data; struct _alpm_hook_t *hook = i->data;
if(hook && hook->when == when && _alpm_hook_triggered(handle, hook)) { if(hook && hook->when == when && _alpm_hook_triggered(handle, hook)) {