threads / patch / 22084

patchUse warning function instead of fprintf(stderr, "Warning: ...").

Subject: [PATCH] Use warning function instead of fprintf(stderr, "Warning: ...").

## tl;dr

2 messages between Jan 2, 2010 and Jan 4, 2010. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Thiago Farina· Jan 2, 2010, 20:24 UTC · lore
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 bisect.c     |    2 +-
 builtin-mv.c |    4 +---
 http.c       |    2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)
Show changes to 3 files +3 −5

bisect.c, builtin-mv.c, http.c

diff --git a/bisect.c b/bisect.c
index dc18db8..d1f8c42 100644
--- a/bisect.c
+++ b/bisect.c
@@ -813,7 +813,7 @@ static void handle_skipped_merge_base(const unsigned char *mb)
 	char *bad_hex = sha1_to_hex(current_bad_sha1);
 	char *good_hex = join_sha1_array_hex(&good_revs, ' ');
 
-	fprintf(stderr, "Warning: the merge base between %s and [%s] "
+	warning("the merge base between %s and [%s] "
 		"must be skipped.\n"
 		"So we cannot be sure the first bad commit is "
 		"between %s and %s.\n"
diff --git a/builtin-mv.c b/builtin-mv.c
index f633d81..8ad7245 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -169,9 +169,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				 * check both source and destination
 				 */
 				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					fprintf(stderr, "Warning: %s;"
-							" will overwrite!\n",
-							bad);
+					warning("%s; will overwrite!\n", bad);
 					bad = NULL;
 				} else
 					bad = "Cannot overwrite";
diff --git a/http.c b/http.c
index ed6414a..afce7c3 100644
--- a/http.c
+++ b/http.c
@@ -1244,7 +1244,7 @@ int finish_http_object_request(struct http_object_request *freq)
 	process_http_object_request(freq);
 
 	if (freq->http_code == 416) {
-		fprintf(stderr, "Warning: requested range invalid; we may already have all the data.\n");
+		warning("requested range invalid; we may already have all the data.\n");
 	} else if (freq->curl_result != CURLE_OK) {
 		if (stat(freq->tmpfile, &st) == 0)
 			if (st.st_size == 0)
-- 
1.6.6.rc3
Johannes Sixt· Jan 4, 2010, 16:02 UTC · re: Thiago Farina · lore

Re: [PATCH] Use warning function instead of fprintf(stderr, "Warning: ...").

Did you actually test any of the changed warnings? You should see extra empty lines because warning() adds its own LF and you didn't remove any.

-- Hannes

← back to recent threads