summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2021-04-25 20:03:54 +0200
committerAllan McRae <allan@archlinux.org>2021-05-01 04:08:14 +0200
commite7fa35baa22bf6710a904815456d3ff679005fc7 (patch)
treec988537bbc720da5fce7de30c39e73f6e67a16a0 /src/util
parent523c393e9e6175e632d355c9440abb0be164a362 (diff)
downloadpacman-e7fa35baa22bf6710a904815456d3ff679005fc7.tar.gz
pacman-e7fa35baa22bf6710a904815456d3ff679005fc7.tar.xz
add front-end provided context to callbacks
Our callbacks require front-ends to maintain state in order to provide reasonable output. The new download callback in particular requires much more complex state information to be saved. Without the ability to provide context, state must be saved globally, which may not be possible for all front-ends. Scripting language bindings in particular have no way to register per-handle callbacks without some form of context. Implements: FS#12721 Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/testpkg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 28dcdc50..26600a9d 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -24,9 +24,10 @@
#include <alpm.h>
#include "util.h" /* For Localization */
-__attribute__((format(printf, 2, 0)))
-static void output_cb(alpm_loglevel_t level, const char *fmt, va_list args)
+__attribute__((format(printf, 3, 0)))
+static void output_cb(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args)
{
+ (void)ctx;
if(fmt[0] == '\0') {
return;
}
@@ -64,7 +65,7 @@ int main(int argc, char *argv[])
}
/* let us get log messages from libalpm */
- alpm_option_set_logcb(handle, output_cb);
+ alpm_option_set_logcb(handle, output_cb, NULL);
/* set gpgdir to default */
alpm_option_set_gpgdir(handle, GPGDIR);