Skip to contentSkip to conversation

usage.c: remove unused functions

PATCH In review Nanako Shiraishi 7 participants 7 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usage.c: remove unused functions

This removes three functions that are not used anywhere.

---
 git-compat-util.h |    3 ---
 usage.c           |   16 ----------------
 2 files changed, 0 insertions(+), 19 deletions(-)
git-compat-util.h +0 -3
index db2836f..2ac832f 100644
@@ -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);
usage.c +0 -16
index a5fc4ec..24f5fc0 100644
@@ -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);
Signature · 5 lines
1.6.0.2

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
#1 lore raw
Quoted 1 line · Nanako Shiraishi

This removes three functions that are not used anywhere.

[...]

Quoted 1 line

-void set_usage_routine(void (*routine)(const char *err) NORETURN)

[...]

Quoted 1 line

-void set_error_routine(void (*routine)(const char *err, va_list params))

[...]

Quoted 1 line

-void set_warn_routine(void (*routine)(const char *warn, va_list params))

These blame to the following commit:

commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
Author: Petr Baudis <[email protected]>
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

Signature · 2 lines
Thomas Rast
[email protected]
#2 lore raw
Quoted 17 lines · Thomas Rast
Quoted 1 line · Nanako Shiraishi

This removes three functions that are not used anywhere.

[...]

Quoted 1 line

-void set_usage_routine(void (*routine)(const char *err) NORETURN)

[...]

Quoted 1 line

-void set_error_routine(void (*routine)(const char *err, va_list params))

[...]

Quoted 1 line

-void set_warn_routine(void (*routine)(const char *warn, va_list params))

These blame to the following commit:

commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
Author: Petr Baudis <[email protected]>
Date: Sat Jun 24 04:34:38 2006 +0200

Customizable error handlers

Quoted 8 lines

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

Signature · 3 lines
				Petr "Pasky" Baudis
People who take cold baths never have rheumatism, but they have
cold baths.
#3 lore raw
Quoted 14 lines · Petr Baudis
Quoted 13 lines · Thomas Rast
Quoted 1 line · Nanako Shiraishi

This removes three functions that are not used anywhere.

[...]

usage.c static void (*die_routine)(const char *err, va_list params) NORETURN = die_built · line 59

Quoted 3 lines
usage.c +0 -3
-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 <[email protected]>

Customizable error handlers

...

Quoted 8 lines
Quoted 3 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.

Signature · 1 line
Shawn.
#4 lore raw

Shawn O. Pearce <[email protected]> wrote Thu, Sep 25, 2008:

Quoted 4 lines

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.

Signature · 1 line
Jonas Fonseca
Acked-by
#5 lore raw
In reply to Shawn O. Pearce
Quoted 25 lines · Shawn O. Pearce
Quoted 14 lines · Petr Baudis
Quoted 13 lines · Thomas Rast
Quoted 1 line · Nanako Shiraishi

This removes three functions that are not used anywhere.

[...]

usage.c static void (*die_routine)(const char *err, va_list params) NORETURN = die_built · line 59

Quoted 3 lines
usage.c +0 -3
-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 <[email protected]>

Customizable error handlers

...

Quoted 8 lines
Quoted 3 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).

Quoted 4 lines

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

--
larsh

#6 lore raw
In reply to Thomas Rast
Quoted 17 lines · Thomas Rast
Quoted 1 line · Nanako Shiraishi

This removes three functions that are not used anywhere.

[...]

Quoted 1 line

-void set_usage_routine(void (*routine)(const char *err) NORETURN)

[...]

Quoted 1 line

-void set_error_routine(void (*routine)(const char *err, va_list params))

[...]

Quoted 1 line

-void set_warn_routine(void (*routine)(const char *warn, va_list params))

These blame to the following commit:

commit 39a3f5ea7c0352a530338d30d4e618f6b4db84e4
Author: Petr Baudis <[email protected]>
Date: Sat Jun 24 04:34:38 2006 +0200

Customizable error handlers

Quoted 8 lines

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

Signature · 3 lines
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git