diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/pacman/callback.c | 18 | ||||
-rw-r--r-- | src/pacman/callback.h | 14 | ||||
-rw-r--r-- | src/pacman/conf.c | 18 | ||||
-rw-r--r-- | src/util/testpkg.c | 7 |
4 files changed, 33 insertions, 24 deletions
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 9628779a..c3563af3 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -232,8 +232,9 @@ static int number_length(size_t n) } /* callback to handle messages/notifications from libalpm transactions */ -void cb_event(alpm_event_t *event) +void cb_event(void *ctx, alpm_event_t *event) { + (void)ctx; if(config->print) { console_cursor_move_end(); return; @@ -436,8 +437,9 @@ void cb_event(alpm_event_t *event) } /* callback to handle questions from libalpm transactions (yes/no) */ -void cb_question(alpm_question_t *question) +void cb_question(void *ctx, alpm_question_t *question) { + (void)ctx; if(config->print) { switch(question->type) { case ALPM_QUESTION_INSTALL_IGNOREPKG: @@ -558,8 +560,8 @@ void cb_question(alpm_question_t *question) } /* callback to handle display of transaction progress */ -void cb_progress(alpm_progress_t event, const char *pkgname, int percent, - size_t howmany, size_t current) +void cb_progress(void *ctx, alpm_progress_t event, const char *pkgname, + int percent, size_t howmany, size_t current) { static int prevpercent; static size_t prevcurrent; @@ -573,6 +575,8 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent, const unsigned short cols = getcols(); + (void)ctx; + if(config->noprogressbar || cols == 0) { return; } @@ -1067,8 +1071,9 @@ static void dload_complete_event(const char *filename, alpm_download_event_compl } /* Callback to handle display of download progress */ -void cb_download(const char *filename, alpm_download_event_type_t event, void *data) +void cb_download(void *ctx, const char *filename, alpm_download_event_type_t event, void *data) { + (void)ctx; if(event == ALPM_DOWNLOAD_INIT) { dload_init_event(filename, data); } else if(event == ALPM_DOWNLOAD_PROGRESS) { @@ -1082,8 +1087,9 @@ void cb_download(const char *filename, alpm_download_event_type_t event, void *d } /* Callback to handle notifications from the library */ -void cb_log(alpm_loglevel_t level, const char *fmt, va_list args) +void cb_log(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args) { + (void)ctx; if(!fmt || strlen(fmt) == 0) { return; } diff --git a/src/pacman/callback.h b/src/pacman/callback.h index 8ac9d960..83cf8cdd 100644 --- a/src/pacman/callback.h +++ b/src/pacman/callback.h @@ -26,22 +26,22 @@ #include <alpm.h> /* callback to handle messages/notifications from libalpm */ -void cb_event(alpm_event_t *event); +void cb_event(void *ctx, alpm_event_t *event); /* callback to handle questions from libalpm (yes/no) */ -void cb_question(alpm_question_t *question); +void cb_question(void *ctx, alpm_question_t *question); /* callback to handle display of progress */ -void cb_progress(alpm_progress_t event, const char *pkgname, int percent, - size_t howmany, size_t remain); +void cb_progress(void *ctx, alpm_progress_t event, const char *pkgname, + int percent, size_t howmany, size_t remain); /* callback to handle display of download progress */ -void cb_download(const char *filename, alpm_download_event_type_t event, +void cb_download(void *ctx, const char *filename, alpm_download_event_type_t event, void *data); /* callback to handle messages/notifications from pacman library */ -__attribute__((format(printf, 2, 0))) -void cb_log(alpm_loglevel_t level, const char *fmt, va_list args); +__attribute__((format(printf, 3, 0))) +void cb_log(void *ctx, alpm_loglevel_t level, const char *fmt, va_list args); /* specify if multibar UI should move completed bars to the top of the screen */ void multibar_move_completed_up(bool value); diff --git a/src/pacman/conf.c b/src/pacman/conf.c index 0f0c2cfb..12fee64c 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -278,8 +278,8 @@ static int systemvp(const char *file, char *const argv[]) } /** External fetch callback */ -static int download_with_xfercommand(const char *url, const char *localpath, - int force) +static int download_with_xfercommand(void *ctx, const char *url, + const char *localpath, int force) { int ret = 0, retval; int usepart = 0; @@ -289,6 +289,8 @@ static int download_with_xfercommand(const char *url, const char *localpath, const char **argv; size_t i; + (void)ctx; + if(!config->xfercommand_argv) { return -1; } @@ -843,11 +845,11 @@ static int setup_libalpm(void) } config->handle = handle; - alpm_option_set_logcb(handle, cb_log); - alpm_option_set_dlcb(handle, cb_download); - alpm_option_set_eventcb(handle, cb_event); - alpm_option_set_questioncb(handle, cb_question); - alpm_option_set_progresscb(handle, cb_progress); + alpm_option_set_logcb(handle, cb_log, NULL); + alpm_option_set_dlcb(handle, cb_download, NULL); + alpm_option_set_eventcb(handle, cb_event, NULL); + alpm_option_set_questioncb(handle, cb_question, NULL); + alpm_option_set_progresscb(handle, cb_progress, NULL); if(config->op == PM_OP_FILES) { alpm_option_set_dbext(handle, ".files"); @@ -894,7 +896,7 @@ static int setup_libalpm(void) } if(config->xfercommand) { - alpm_option_set_fetchcb(handle, download_with_xfercommand); + alpm_option_set_fetchcb(handle, download_with_xfercommand, NULL); } else if(!(alpm_capabilities() & ALPM_CAPABILITY_DOWNLOADER)) { pm_printf(ALPM_LOG_WARNING, _("no '%s' configured\n"), "XferCommand"); } 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); |