# [PATCH] string-list: remove print_string_list, since it is not used anymore.

6 messages from 2010-01-11 to 2010-01-11. Participants: Thiago Farina, Johannes Schindelin, Junio C Hamano, Nicolas Pitre.
Thread: https://gitlist.dev/t/22175

## Thiago Farina, 2010-01-11 21:29

Subject: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <1263245389-1558-1-git-send-email-tfransosi@gmail.com>
URL: https://gitlist.dev/e/1263245389-1558-1-git-send-email-tfransosi%40gmail.com

```
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
---
 string-list.c |   10 ----------
 string-list.h |    1 -
 2 files changed, 0 insertions(+), 11 deletions(-)

diff --git a/string-list.c b/string-list.c
index 1ac536e..e929745 100644
--- a/string-list.c
+++ b/string-list.c
@@ -138,16 +138,6 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
 	list->nr = list->alloc = 0;
 }
 
-
-void print_string_list(const char *text, const struct string_list *p)
-{
-	int i;
-	if ( text )
-		printf("%s\n", text);
-	for (i = 0; i < p->nr; i++)
-		printf("%s:%p\n", p->items[i].string, p->items[i].util);
-}
-
 struct string_list_item *string_list_append(const char *string, struct string_list *list)
 {
 	ALLOC_GROW(list->items, list->nr + 1, list->alloc);
diff --git a/string-list.h b/string-list.h
index 6569cf6..8598257 100644
--- a/string-list.h
+++ b/string-list.h
@@ -12,7 +12,6 @@ struct string_list
 	unsigned int strdup_strings:1;
 };
 
-void print_string_list(const char *text, const struct string_list *p);
 void string_list_clear(struct string_list *list, int free_util);
 
 /* Use this function to call a custom clear function on each util pointer */
-- 
1.6.6.103.g699d2

```

## Johannes Schindelin, 2010-01-11 21:52

Subject: Re: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <alpine.DEB.1.00.1001112252040.4985@pacific.mpi-cbg.de>
URL: https://gitlist.dev/e/alpine.DEB.1.00.1001112252040.4985%40pacific.mpi-cbg.de
In-Reply-To: <1263245389-1558-1-git-send-email-tfransosi@gmail.com>

```
Hi.

On Mon, 11 Jan 2010, Thiago Farina wrote:

> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> ---

It was never used, except for debugging.  Does it hurt you really all that 
much?

Ciao,
Dscho

```

## Junio C Hamano, 2010-01-11 22:14

Subject: Re: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <7v3a2ccmrg.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v3a2ccmrg.fsf%40alter.siamese.dyndns.org
In-Reply-To: <alpine.DEB.1.00.1001112252040.4985@pacific.mpi-cbg.de>

```
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> On Mon, 11 Jan 2010, Thiago Farina wrote:
>
>> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
>> ---
>
> It was never used, except for debugging.  Does it hurt you really all that 
> much?

Exactly my feeling.

I think I discarded at least two other patches sent to me to remove this
"unused" (but obviously meant for debugging) function in the past.  I
guess we'll keep the function this time, too.

```

## Nicolas Pitre, 2010-01-11 22:23

Subject: Re: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <alpine.LFD.2.00.1001111722150.10143@xanadu.home>
URL: https://gitlist.dev/e/alpine.LFD.2.00.1001111722150.10143%40xanadu.home
In-Reply-To: <7v3a2ccmrg.fsf@alter.siamese.dyndns.org>

```
On Mon, 11 Jan 2010, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Mon, 11 Jan 2010, Thiago Farina wrote:
> >
> >> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
> >> ---
> >
> > It was never used, except for debugging.  Does it hurt you really all that 
> > much?
> 
> Exactly my feeling.
> 
> I think I discarded at least two other patches sent to me to remove this
> "unused" (but obviously meant for debugging) function in the past.  I
> guess we'll keep the function this time, too.

If so many people are so inclined to discard it, then maybe a little 
comment could be added to explain its existance?


Nicolas

```

## Thiago Farina, 2010-01-11 22:34

Subject: Re: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <a4c8a6d01001111434j18b77b88j525b9acb47c7e100@mail.gmail.com>
URL: https://gitlist.dev/e/a4c8a6d01001111434j18b77b88j525b9acb47c7e100%40mail.gmail.com
In-Reply-To: <alpine.LFD.2.00.1001111722150.10143@xanadu.home>

```
On Mon, Jan 11, 2010 at 8:23 PM, Nicolas Pitre <nico@fluxnic.net> wrote:
> On Mon, 11 Jan 2010, Junio C Hamano wrote:
>
>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>>
>> > On Mon, 11 Jan 2010, Thiago Farina wrote:
>> >
>> >> Signed-off-by: Thiago Farina <tfransosi@gmail.com>
>> >> ---
>> >
>> > It was never used, except for debugging.  Does it hurt you really all that
>> > much?
>>
>> Exactly my feeling.
>>
>> I think I discarded at least two other patches sent to me to remove this
>> "unused" (but obviously meant for debugging) function in the past.  I
>> guess we'll keep the function this time, too.
>
> If so many people are so inclined to discard it, then maybe a little
> comment could be added to explain its existance?
>

I can add the comment if Junio is ok with it. Something like this:
"This functions is for debugging purpose only. Please, do NOT remove
it."

```

## Junio C Hamano, 2010-01-11 22:51

Subject: Re: [PATCH] string-list: remove print_string_list, since it is not used anymore.
Message-ID: <7veilwb6gp.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7veilwb6gp.fsf%40alter.siamese.dyndns.org
In-Reply-To: <a4c8a6d01001111434j18b77b88j525b9acb47c7e100@mail.gmail.com>

```
Thiago Farina <tfransosi@gmail.com> writes:

> I can add the comment if Junio is ok with it. Something like this:
> "This functions is for debugging purpose only. Please, do NOT remove
> it."

Something like this should suffice, as I think "Please blah" is just
superfluous.

I don't know if I like "#ifdef DEBUG" better, though.  It will still let
you say "call print_string_list(...)" in your debugger session, and people
wouldn't muck with it even if there is no caller.

diff --git a/string-list.c b/string-list.c
index 1ac536e..793e619 100644
--- a/string-list.c
+++ b/string-list.c
@@ -139,6 +139,7 @@ void string_list_clear_func(struct string_list *list, string_list_clear_func_t c
 }
 
 
+#ifndef NDEBUG
 void print_string_list(const char *text, const struct string_list *p)
 {
 	int i;
@@ -147,6 +148,7 @@ void print_string_list(const char *text, const struct string_list *p)
 	for (i = 0; i < p->nr; i++)
 		printf("%s:%p\n", p->items[i].string, p->items[i].util);
 }
+#endif
 
 struct string_list_item *string_list_append(const char *string, struct string_list *list)
 {
diff --git a/string-list.h b/string-list.h
index 6569cf6..8598257 100644
--- a/string-list.h
+++ b/string-list.h
@@ -12,7 +12,6 @@ struct string_list
 	unsigned int strdup_strings:1;
 };
 
-void print_string_list(const char *text, const struct string_list *p);
 void string_list_clear(struct string_list *list, int free_util);
 
 /* Use this function to call a custom clear function on each util pointer */

```
