summaryrefslogtreecommitdiff
path: root/src/pacman/pacman.c
diff options
context:
space:
mode:
authorRémy Oudompheng <remy@archlinux.org>2011-04-10 00:04:54 +0200
committerDan McGee <dan@archlinux.org>2011-04-15 18:37:10 -0500
commit4ffda3f05b034b55eb5159e0268a34c14b46e686 (patch)
tree5f10349a40b28ee42aee51a8075c85e46cd619a0 /src/pacman/pacman.c
parentdff2d916baac88b71dec0af81645ea2fe876cf6c (diff)
libalpm: consistently use int as return type for option setters
Currently the only error case then when handle == NULL. However several handle functions return -1 on this error, and a uniform API makes things simpler. Signed-off-by: Rémy Oudompheng <remy@archlinux.org>
Diffstat (limited to 'src/pacman/pacman.c')
-rw-r--r--src/pacman/pacman.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 74659c56..c5c83d77 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -412,7 +412,7 @@ static void setlibpaths(void)
#define check_optarg() if(!optarg) { return 1; }
-typedef void (*fn_add) (const char *s);
+typedef int (*fn_add) (const char *s);
static int parsearg_util_addlist(fn_add fn)
{
@@ -810,17 +810,19 @@ static int parseargs(int argc, char *argv[])
}
/* helper for being used with setrepeatingoption */
-static void option_add_holdpkg(const char *name) {
+static int option_add_holdpkg(const char *name) {
config->holdpkg = alpm_list_add(config->holdpkg, strdup(name));
+ return 0;
}
/* helper for being used with setrepeatingoption */
-static void option_add_syncfirst(const char *name) {
+static int option_add_syncfirst(const char *name) {
config->syncfirst = alpm_list_add(config->syncfirst, strdup(name));
+ return 0;
}
/* helper for being used with setrepeatingoption */
-static void option_add_cleanmethod(const char *value) {
+static int option_add_cleanmethod(const char *value) {
if (strcmp(value, "KeepInstalled") == 0) {
config->cleanmethod |= PM_CLEAN_KEEPINST;
} else if (strcmp(value, "KeepCurrent") == 0) {
@@ -829,6 +831,7 @@ static void option_add_cleanmethod(const char *value) {
pm_printf(PM_LOG_ERROR, _("invalid value for 'CleanMethod' : '%s'\n"),
value);
}
+ return 0;
}
/** Add repeating options such as NoExtract, NoUpgrade, etc to libalpm
@@ -839,7 +842,7 @@ static void option_add_cleanmethod(const char *value) {
* @param optionfunc a function pointer to an alpm_option_add_* function
*/
static void setrepeatingoption(char *ptr, const char *option,
- void (*optionfunc)(const char*))
+ int (*optionfunc)(const char*))
{
char *q;