[pacman-dev] [PATCH 1/2] shut up GCC on -Wmaybe-initialized warnings

Dave Reisner dreisner at archlinux.org
Sun Dec 14 17:35:00 UTC 2014


Admittedly, these are totally bogus, but a clean build is a happy build.
---
 src/pacman/conf.c   | 2 +-
 src/pacman/pacman.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 5028284..873ca0e 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -459,7 +459,7 @@ static int process_cleanmethods(alpm_list_t *values,
 static void setrepeatingoption(char *ptr, const char *option,
 		alpm_list_t **list)
 {
-	char *val, *saveptr;
+	char *val, *saveptr = NULL;
 
 	val = strtok_r(ptr, " ", &saveptr);
 	while(val) {
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 6161048..6234570 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -341,8 +341,7 @@ static void invalid_opt(int used, const char *opt1, const char *opt2)
 
 static int parsearg_util_addlist(alpm_list_t **list)
 {
-	char *i, *save;
-
+	char *i, *save = NULL;
 
 	for(i = strtok_r(optarg, ",", &save); i; i = strtok_r(NULL, ",", &save)) {
 		*list = alpm_list_add(*list, strdup(i));
-- 
2.1.3


More information about the pacman-dev mailing list