Commit e4fda954d6d914609498fc3bcbd27b4e2b5834d3

Russell Belfer 2013-07-09T16:46:18

A little git_config_get_multivar code cleanup

diff --git a/src/config.c b/src/config.c
index aaad7d8..2a05854 100644
--- a/src/config.c
+++ b/src/config.c
@@ -534,8 +534,7 @@ int git_config_get_multivar(
 {
 	file_internal *internal;
 	git_config_backend *file;
-	int ret = GIT_ENOTFOUND;
-	int err;
+	int ret = GIT_ENOTFOUND, err;
 	size_t i;
 
 	/*
@@ -548,15 +547,10 @@ int git_config_get_multivar(
 			continue;
 		file = internal->file;
 
-		err = file->get_multivar(file, name, regexp, cb, payload);
-		switch (err) {
-			case GIT_OK:
-				ret = GIT_OK;
-			case GIT_ENOTFOUND:
-				break;
-			default:
-				return err;
-		}
+		if (!(err = file->get_multivar(file, name, regexp, cb, payload)))
+			ret = 0;
+		else if (err != GIT_ENOTFOUND)
+			return err;
 	}
 
 	return (ret == GIT_ENOTFOUND) ? config_error_notfound(name) : 0;