# [PATCH] usage.c: remove unused functions

7 messages from 2008-09-25 to 2008-09-29. Participants: Nanako Shiraishi, Thomas Rast, Petr Baudis, Jakub Narebski, Shawn O. Pearce, Jonas Fonseca, Lars Hjemli.
Thread: https://gitlist.dev/t/15668

## Nanako Shiraishi, 2008-09-25 09:41

Subject: [PATCH] usage.c: remove unused functions
Message-ID: <20080925184104.6117@nanako3.lavabit.com>
URL: https://gitlist.dev/e/20080925184104.6117%40nanako3.lavabit.com

```
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(-)

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, 2008-09-25 11:48

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <200809251348.42789.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200809251348.42789.trast%40student.ethz.ch
In-Reply-To: <20080925184104.6117@nanako3.lavabit.com>

```
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, 2008-09-25 12:48

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <20080925124836.GI10360@machine.or.cz>
URL: https://gitlist.dev/e/20080925124836.GI10360%40machine.or.cz
In-Reply-To: <200809251348.42789.trast@student.ethz.ch>

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

```

## Jakub Narebski, 2008-09-25 12:53

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <gbg1jc$hjm$1@ger.gmane.org>
URL: https://gitlist.dev/e/gbg1jc%24hjm%241%40ger.gmane.org
In-Reply-To: <200809251348.42789.trast@student.ethz.ch>

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

```

## Shawn O. Pearce, 2008-09-25 14:51

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <20080925145134.GL3669@spearce.org>
URL: https://gitlist.dev/e/20080925145134.GL3669%40spearce.org
In-Reply-To: <20080925124836.GI10360@machine.or.cz>

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

-- 
Shawn.

```

## Jonas Fonseca, 2008-09-25 20:43

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <20080925204341.GA22708@diku.dk>
URL: https://gitlist.dev/e/20080925204341.GA22708%40diku.dk
In-Reply-To: <20080925145134.GL3669@spearce.org>

```
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, 2008-09-29 06:35

Subject: Re: [PATCH] usage.c: remove unused functions
Message-ID: <8c5c35580809282335q7eb828eei1fd545d308d9e5ca@mail.gmail.com>
URL: https://gitlist.dev/e/8c5c35580809282335q7eb828eei1fd545d308d9e5ca%40mail.gmail.com
In-Reply-To: <20080925145134.GL3669@spearce.org>

```
On Thu, Sep 25, 2008 at 4:51 PM, Shawn O. Pearce <spearce@spearce.org> wrote:
> 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

```
