threads / patch / 15668

patchusage.c: remove unused functions

Subject: [PATCH] usage.c: remove unused functions

## tl;dr

7 messages between Sep 25, 2008 and Sep 29, 2008. Diffs are folded; open one to read it.

replies: 6people: 7as markdown or json

Nanako Shiraishi· Sep 25, 2008, 09:41 UTC · lore
This removes three functions that are not used anywhere.
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
---
 git-compat-util.h |    3 ---
 usage.c           |   16 ----------------
 2 files changed, 0 insertions(+), 19 deletions(-)
Show changes to 2 files +0 −19

git-compat-util.h, usage.c

diff --git a/git-compat-util.h b/git-compat-util.h
index db2836f..2ac832f 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -154,10 +154,7 @@ extern void die(const char *err, ...) NORETURN __attribute__((format (printf, 1,
 extern int error(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);
-extern void set_error_routine(void (*routine)(const char *err, va_list params));
-extern void set_warn_routine(void (*routine)(const char *warn, va_list params));
 
 extern int prefixcmp(const char *str, const char *prefix);
 extern time_t tm_to_time_t(const struct tm *tm);
diff --git a/usage.c b/usage.c
index a5fc4ec..24f5fc0 100644
--- a/usage.c
+++ b/usage.c
@@ -41,27 +41,11 @@ static void (*die_routine)(const char *err, va_list params) NORETURN = die_built
 static void (*error_routine)(const char *err, va_list params) = error_builtin;
 static void (*warn_routine)(const char *err, va_list params) = warn_builtin;
 
-void set_usage_routine(void (*routine)(const char *err) NORETURN)
-{
-	usage_routine = routine;
-}
-
 void set_die_routine(void (*routine)(const char *err, va_list params) NORETURN)
 {
 	die_routine = routine;
 }
 
-void set_error_routine(void (*routine)(const char *err, va_list params))
-{
-	error_routine = routine;
-}
-
-void set_warn_routine(void (*routine)(const char *warn, va_list params))
-{
-	warn_routine = routine;
-}
-
-
 void usage(const char *err)
 {
 	usage_routine(err);
-- 
1.6.0.2

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
Thomas Rast· Sep 25, 2008, 11:48 UTC · re: Nanako Shiraishi · lore

Re: [PATCH] usage.c: remove unused functions

Nanako Shiraishi wrote:
> This removes three functions that are not used anywhere.
[...]
> -void set_usage_routine(void (*routine)(const char *err) NORETURN)
[...]
> -void set_error_routine(void (*routine)(const char *err, va_list params))
[...]
> -void set_warn_routine(void (*routine)(const char *warn, va_list params))
These blame to the following commit:
  commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
  Author: Petr Baudis <pasky@suse.cz>
  Date:   Sat Jun 24 04:34:38 2006 +0200
      Customizable error handlers
      
      This patch makes the usage(), die() and error() handlers customizable.
      Nothing in the git code itself uses that but many other libgit users
      (like Git.pm) will.
  [...]

So apparently the intent was that they would only be used from outside Git. I don't know whether anyone still plans to do that, but they're certainly not "just" unused.

- Thomas
-- 
Thomas Rast
trast@student.ethz.ch
Petr Baudis· Sep 25, 2008, 12:48 UTC · re: Thomas Rast · lore

Re: [PATCH] usage.c: remove unused functions

On Thu, Sep 25, 2008 at 01:48:37PM +0200, Thomas Rast wrote:
Show 25 quoted lines
> Nanako Shiraishi wrote:
> > This removes three functions that are not used anywhere.
> [...]
> > -void set_usage_routine(void (*routine)(const char *err) NORETURN)
> [...]
> > -void set_error_routine(void (*routine)(const char *err, va_list params))
> [...]
> > -void set_warn_routine(void (*routine)(const char *warn, va_list params))
> 
> These blame to the following commit:
> 
>   commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
>   Author: Petr Baudis <pasky@suse.cz>
>   Date:   Sat Jun 24 04:34:38 2006 +0200
> 
>       Customizable error handlers
>       
>       This patch makes the usage(), die() and error() handlers customizable.
>       Nothing in the git code itself uses that but many other libgit users
>       (like Git.pm) will.
>   [...]
> 
> So apparently the intent was that they would only be used from outside
> Git.  I don't know whether anyone still plans to do that, but they're
> certainly not "just" unused.

I don't think it will be a big deal to remove these functions, though it does feel like a little bit of a step backwards in the libgit efforts. There are some programs that already link to Git, like CGit - I wonder if some of them don't use them (CGit itself doesn't).

-- 
				Petr "Pasky" Baudis
People who take cold baths never have rheumatism, but they have
cold baths.
Shawn O. Pearce· Sep 25, 2008, 14:51 UTC · re: Petr Baudis · lore

Re: [PATCH] usage.c: remove unused functions

Petr Baudis <pasky@suse.cz> wrote:
Show 14 quoted lines
> On Thu, Sep 25, 2008 at 01:48:37PM +0200, Thomas Rast wrote:
> > Nanako Shiraishi wrote:
> > > This removes three functions that are not used anywhere.
> > [...]
> > > -void set_usage_routine(void (*routine)(const char *err) NORETURN)
> > > -void set_error_routine(void (*routine)(const char *err, va_list params))
> > > -void set_warn_routine(void (*routine)(const char *warn, va_list params))
> > 
> > These blame to the following commit:
> > 
> >   commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
> >   Author: Petr Baudis <pasky@suse.cz>
> > 
> >       Customizable error handlers
...
Show 8 quoted lines
> > So apparently the intent was that they would only be used from outside
> > Git.  I don't know whether anyone still plans to do that, but they're
> > certainly not "just" unused.
> 
> I don't think it will be a big deal to remove these functions, though it
> does feel like a little bit of a step backwards in the libgit efforts.
> There are some programs that already link to Git, like CGit - I wonder
> if some of them don't use them (CGit itself doesn't).

IMHO these are useless for a "libgit". However both tig and cgit link to the non-existant libgit.a, so they may be using these routines. I've CC'd their authors and am not applying this particular change without an ACK from them.

-- 
Shawn.
Jonas Fonseca· Sep 25, 2008, 20:43 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] usage.c: remove unused functions

Shawn O. Pearce <spearce@spearce.org> wrote Thu, Sep 25, 2008:
> IMHO these are useless for a "libgit".  However both tig and
> cgit link to the non-existant libgit.a, so they may be using
> these routines.  I've CC'd their authors and am not applying this
> particular change without an ACK from them.
This is not a problem for tig since it doesn't use libgit at all.
-- 
Jonas Fonseca
Lars Hjemli· Sep 29, 2008, 06:35 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] usage.c: remove unused functions

On Thu, Sep 25, 2008 at 4:51 PM, Shawn O. Pearce <spearce@spearce.org> wrote:
Show 29 quoted lines
> Petr Baudis <pasky@suse.cz> wrote:
>> On Thu, Sep 25, 2008 at 01:48:37PM +0200, Thomas Rast wrote:
>> > Nanako Shiraishi wrote:
>> > > This removes three functions that are not used anywhere.
>> > [...]
>> > > -void set_usage_routine(void (*routine)(const char *err) NORETURN)
>> > > -void set_error_routine(void (*routine)(const char *err, va_list params))
>> > > -void set_warn_routine(void (*routine)(const char *warn, va_list params))
>> >
>> > These blame to the following commit:
>> >
>> >   commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
>> >   Author: Petr Baudis <pasky@suse.cz>
>> >
>> >       Customizable error handlers
> ...
>> > So apparently the intent was that they would only be used from outside
>> > Git.  I don't know whether anyone still plans to do that, but they're
>> > certainly not "just" unused.
>>
>> I don't think it will be a big deal to remove these functions, though it
>> does feel like a little bit of a step backwards in the libgit efforts.
>> There are some programs that already link to Git, like CGit - I wonder
>> if some of them don't use them (CGit itself doesn't).
>
> IMHO these are useless for a "libgit".  However both tig and
> cgit link to the non-existant libgit.a, so they may be using
> these routines.  I've CC'd their authors and am not applying this
> particular change without an ACK from them.

Sorry for the late reply. And no, cgit doesn't use these functions and I don't think that's going to change, so

Acked-by: Lars Hjemli <hjemli@gmail.com>

-- larsh

Jakub Narebski· Sep 25, 2008, 12:53 UTC · re: Thomas Rast · lore

Re: [PATCH] usage.c: remove unused functions

Thomas Rast wrote:
Show 25 quoted lines
> Nanako Shiraishi wrote:
>> This removes three functions that are not used anywhere.
> [...]
>> -void set_usage_routine(void (*routine)(const char *err) NORETURN)
> [...]
>> -void set_error_routine(void (*routine)(const char *err, va_list params))
> [...]
>> -void set_warn_routine(void (*routine)(const char *warn, va_list params))
> 
> These blame to the following commit:
> 
>   commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
>   Author: Petr Baudis <pasky@suse.cz>
>   Date:   Sat Jun 24 04:34:38 2006 +0200
> 
>       Customizable error handlers
>       
>       This patch makes the usage(), die() and error() handlers customizable.
>       Nothing in the git code itself uses that but many other libgit users
>       (like Git.pm) will.
>   [...]
> 
> So apparently the intent was that they would only be used from outside
> Git.  I don't know whether anyone still plans to do that, but they're
> certainly not "just" unused.

By the way, those functions could be used to implement "git --silent <cmd>", which is equivalent of "git <cmd> 2>/dev/null" (which you don't always can do easily).

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

← back to recent threads