Skip to content

Commit

Permalink
Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
Browse files Browse the repository at this point in the history
This fixes a problem reported by Randal Schwartz:

>I finally tracked down all the (albeit inconsequential) errors I was getting
>on both OpenBSD and OSX.  It's the warn() function in usage.c.  There's
>warn(3) in BSD-style distros.  It'd take a "great rename" to change it, but if
>someone with better C skills than I have could do that, my linker and I would
>appreciate it.

It was annoying to me, too, when I was doing some mergetool testing on
Mac OS X, so here's a fix.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: "Randal L. Schwartz" <merlyn@stonehenge.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
tytso authored and Junio C Hamano committed Mar 31, 2007
1 parent 86747c1 commit 46efd2d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions builtin-bundle.c
Expand Up @@ -87,7 +87,7 @@ static int read_header(const char *path, struct bundle_header *header) {
if (buffer[len - 1] == '\n')
buffer[len - 1] = '\0';
if (get_sha1_hex(buffer + offset, sha1)) {
warn("unrecognized header: %s", buffer);
warning("unrecognized header: %s", buffer);
continue;
}
delim = buffer[40 + offset];
Expand Down Expand Up @@ -268,7 +268,7 @@ static int create_bundle(struct bundle_header *header, const char *path,
* from getting output.
*/
if (!(e->item->flags & SHOWN)) {
warn("ref '%s' is excluded by the rev-list options",
warning("ref '%s' is excluded by the rev-list options",
e->name);
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion fast-import.c
Expand Up @@ -1312,7 +1312,7 @@ static int update_branch(struct branch *b)

if (!in_merge_bases(old_cmit, &new_cmit, 1)) {
unlock_ref(lock);
warn("Not updating %s"
warning("Not updating %s"
" (new tip %s does not contain %s)",
b->name, sha1_to_hex(b->sha1), sha1_to_hex(old_sha1));
return -1;
Expand Down
2 changes: 1 addition & 1 deletion git-compat-util.h
Expand Up @@ -87,7 +87,7 @@
extern void usage(const char *err) NORETURN;
extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1, 2)));
extern int error(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warn(const char *err, ...) __attribute__((format (printf, 1, 2)));
extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2)));

extern void set_usage_routine(void (*routine)(const char *err) NORETURN);
extern void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN);
Expand Down
2 changes: 1 addition & 1 deletion revision.c
Expand Up @@ -486,7 +486,7 @@ static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
add_pending_object(cb->all_revs, o, "");
}
else if (!cb->warned_bad_reflog) {
warn("reflog of '%s' references pruned commits",
warning("reflog of '%s' references pruned commits",
cb->name_for_errormsg);
cb->warned_bad_reflog = 1;
}
Expand Down
2 changes: 1 addition & 1 deletion usage.c
Expand Up @@ -86,7 +86,7 @@ int error(const char *err, ...)
return -1;
}

void warn(const char *warn, ...)
void warning(const char *warn, ...)
{
va_list params;

Expand Down

0 comments on commit 46efd2d

Please sign in to comment.