@matheusbsbs / matheus-bagliano / commits / eca2a8f023
Fork 0

builtin-apply: use warning() instead of fprintf(stderr, "warning: ")

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Miklos Vajna committed Mar 24, 2009 at 02:09 UTC eca2a8f0236a3b5b2c3afca2643d433a51a205fe
1 file changed +7 -8
builtin-apply.c
+7 -8
@@ -2451,7 +2451,7 @@ static int check_preimage(struct patch *patch, struct cache_entry **ce, struct s
2451 if ((st_mode ^ patch->old_mode) & S_IFMT)
2452 return error("%s: wrong type", old_name);
2453 if (st_mode != patch->old_mode)
2454 - fprintf(stderr, "warning: %s has type %o, expected %o\n",
2454 + warning("%s has type %o, expected %o",
2455 old_name, st_mode, patch->old_mode);
2456 if (!patch->new_mode && !patch->is_delete)
2457 patch->new_mode = st_mode;
@@ -2932,8 +2932,7 @@ static int write_out_one_reject(struct patch *patch)
2932 cnt = strlen(patch->new_name);
2933 if (ARRAY_SIZE(namebuf) <= cnt + 5) {
2934 cnt = ARRAY_SIZE(namebuf) - 5;
2935 - fprintf(stderr,
2936 - "warning: truncating .rej filename to %.*s.rej",
2935 + warning("truncating .rej filename to %.*s.rej",
2936 cnt - 1, patch->new_name);
2937 }
2938 memcpy(namebuf, patch->new_name, cnt);
@@ -3315,8 +3314,8 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
3314 squelch_whitespace_errors < whitespace_error) {
3315 int squelched =
3316 whitespace_error - squelch_whitespace_errors;
3318 - fprintf(stderr, "warning: squelched %d "
3319 - "whitespace error%s\n",
3317 + warning("squelched %d "
3318 + "whitespace error%s",
3319 squelched,
3320 squelched == 1 ? "" : "s");
3321 }
@@ -3326,12 +3325,12 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
3325 whitespace_error == 1 ? "" : "s",
3326 whitespace_error == 1 ? "s" : "");
3327 if (applied_after_fixing_ws && apply)
3329 - fprintf(stderr, "warning: %d line%s applied after"
3330 - " fixing whitespace errors.\n",
3328 + warning("%d line%s applied after"
3329 + " fixing whitespace errors.",
3330 applied_after_fixing_ws,
3331 applied_after_fixing_ws == 1 ? "" : "s");
3332 else if (whitespace_error)
3334 - fprintf(stderr, "warning: %d line%s add%s whitespace errors.\n",
3333 + warning("%d line%s add%s whitespace errors.",
3334 whitespace_error,
3335 whitespace_error == 1 ? "" : "s",
3336 whitespace_error == 1 ? "s" : "");