From bad3e13eaa9aab12388d15309f12582de9b83ab0 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Wed, 22 Nov 2023 14:22:09 -0800 Subject: [PATCH] conf.c: remove unnecessary _add_mirror function It does very little, is only used in one place, and can't easily be reused for other server types due to the inclusion of an error message. Signed-off-by: Andrew Gregory --- src/pacman/conf.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/src/pacman/conf.c b/src/pacman/conf.c index b7599b9e..a476d157 100644 --- a/src/pacman/conf.c +++ b/src/pacman/conf.c @@ -781,18 +781,6 @@ static char *replace_server_vars(config_t *c, config_repo_t *r, const char *s) } } -static int _add_mirror(alpm_db_t *db, char *value) -{ - if(alpm_db_add_server(db, value) != 0) { - /* pm_errno is set by alpm_db_setserver */ - pm_printf(ALPM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"), - alpm_db_get_name(db), value, alpm_strerror(alpm_errno(config->handle))); - return 1; - } - - return 0; -} - static int register_repo(config_repo_t *repo) { alpm_list_t *i; @@ -810,7 +798,11 @@ static int register_repo(config_repo_t *repo) alpm_db_set_usage(db, repo->usage); for(i = repo->servers; i; i = alpm_list_next(i)) { - if(_add_mirror(db, i->data) != 0) { + const char *value = i->data; + if(alpm_db_add_server(db, value) != 0) { + /* pm_errno is set by alpm_db_setserver */ + pm_printf(ALPM_LOG_ERROR, _("could not add server URL to database '%s': %s (%s)\n"), + alpm_db_get_name(db), value, alpm_strerror(alpm_errno(config->handle))); return 1; } }