git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
@ 2007-03-30 23:07 Theodore Ts'o
  2007-03-31  8:15 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Theodore Ts'o @ 2007-03-30 23:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, Theodore Ts'o, Randal L. Schwartz

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>
---
 builtin-bundle.c  |    4 ++--
 fast-import.c     |    2 +-
 git-compat-util.h |    2 +-
 revision.c        |    2 +-
 usage.c           |    2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin-bundle.c b/builtin-bundle.c
index 0a9b738..d1635a0 100644
--- a/builtin-bundle.c
+++ b/builtin-bundle.c
@@ -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];
@@ -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;
 		}
diff --git a/fast-import.c b/fast-import.c
index bea1215..cdd629d 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -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;
diff --git a/git-compat-util.h b/git-compat-util.h
index 7534db1..139fc19 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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);
diff --git a/revision.c b/revision.c
index f23c1d5..486393c 100644
--- a/revision.c
+++ b/revision.c
@@ -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;
 		}
diff --git a/usage.c b/usage.c
index 4dc5c77..f5e652c 100644
--- a/usage.c
+++ b/usage.c
@@ -86,7 +86,7 @@ int error(const char *err, ...)
 	return -1;
 }
 
-void warn(const char *warn, ...)
+void warning(const char *warn, ...)
 {
 	va_list params;
 
-- 
1.5.1.rc3.20.gaa453

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
  2007-03-30 23:07 [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS Theodore Ts'o
@ 2007-03-31  8:15 ` Junio C Hamano
  2007-03-31 10:46   ` Johannes Schindelin
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-03-31  8:15 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: git, Randal L. Schwartz

Theodore Ts'o <tytso@mit.edu> writes:

> 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.

I'd take this for now, but I wonder where we should stop.  If
somebody exports error() or die(), would we end up renaming them
to git_error() and git_die()?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
  2007-03-31  8:15 ` Junio C Hamano
@ 2007-03-31 10:46   ` Johannes Schindelin
  2007-03-31 14:48   ` Randal L. Schwartz
  2007-04-01 10:25   ` Alex Riesen
  2 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2007-03-31 10:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Theodore Ts'o, git, Randal L. Schwartz

Hi,

On Sat, 31 Mar 2007, Junio C Hamano wrote:

> Theodore Ts'o <tytso@mit.edu> writes:
> 
> > 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.
> 
> I'd take this for now, but I wonder where we should stop.  If
> somebody exports error() or die(), would we end up renaming them
> to git_error() and git_die()?

Libification, here we come ;-)

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
  2007-03-31  8:15 ` Junio C Hamano
  2007-03-31 10:46   ` Johannes Schindelin
@ 2007-03-31 14:48   ` Randal L. Schwartz
  2007-04-01 10:25   ` Alex Riesen
  2 siblings, 0 replies; 5+ messages in thread
From: Randal L. Schwartz @ 2007-03-31 14:48 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Theodore Ts'o, git

>>>>> "Junio" == Junio C Hamano <junkio@cox.net> writes:

Junio> I'd take this for now, but I wonder where we should stop.  If
Junio> somebody exports error() or die(), would we end up renaming them
Junio> to git_error() and git_die()?

I realize you may see it as a slippery slope, but I haven't heard anything
else reported yet, and git has already been ported quite a bit.  But since C
has a flat namespace, this will always be a problem.

Picking a name like warn(3) was probably dumb on bsd's part, but it *is* a
generic call like perror(3).

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS
  2007-03-31  8:15 ` Junio C Hamano
  2007-03-31 10:46   ` Johannes Schindelin
  2007-03-31 14:48   ` Randal L. Schwartz
@ 2007-04-01 10:25   ` Alex Riesen
  2 siblings, 0 replies; 5+ messages in thread
From: Alex Riesen @ 2007-04-01 10:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Theodore Ts'o, git, Randal L. Schwartz

Junio C Hamano, Sat, Mar 31, 2007 10:15:31 +0200:
> >>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.
> 
> I'd take this for now, but I wonder where we should stop. 

Glibc also has warn(3) - see err.h for example.
(why is it part of libc, I wonder...)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-04-01 10:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30 23:07 [PATCH] Rename warn() to warning() to fix symbol conflicts on BSD and Mac OS Theodore Ts'o
2007-03-31  8:15 ` Junio C Hamano
2007-03-31 10:46   ` Johannes Schindelin
2007-03-31 14:48   ` Randal L. Schwartz
2007-04-01 10:25   ` Alex Riesen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).