From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <sbeller@google.com>
Cc: marius@trolltech.com, julian@quantumfyre.co.uk, git@vger.kernel.org
Subject: Re: [PATCH 3/3] string_list: Remove string_list_insert_at_index from its API
Date: Mon, 24 Nov 2014 16:25:59 -0800 [thread overview]
Message-ID: <xmqq7fykunvs.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1416864124-15231-3-git-send-email-sbeller@google.com> (Stefan Beller's message of "Mon, 24 Nov 2014 13:22:04 -0800")
Stefan Beller <sbeller@google.com> writes:
> This function behaves the same as string_list_insert, just the
> starting indexes for searching, where to insert into the list is also
> a parameter. So if you have knowledge on where to search for the string
> to be inserted, you may have a speed up version of string_list_insert.
The last half-sentence I am having trouble parsing. If you have
that knowledge where the item should go, you can insert it at the
right location faster than calling string_list_insert()?
That sounds like a useful feature to me.
But if nobody uses that feature, there is no point keeping it, no
matter how useful it may sound. So,... I am not sure.
The function would be error prone if used on a string-list that is
accessed via string_list_insert() API, which makes it only useful if
the user of the API is in full control of the sort order, so I do
not mind removing it and won't be saying "that is useful, we should
keep it and use it more."
But your log message confuses me....
>
> As we're not using this function throughout the codebase, get rid of it.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> string-list.c | 8 +-------
> string-list.h | 2 --
> 2 files changed, 1 insertion(+), 9 deletions(-)
>
> diff --git a/string-list.c b/string-list.c
> index c5aa076..9584fa6 100644
> --- a/string-list.c
> +++ b/string-list.c
> @@ -59,13 +59,7 @@ static int add_entry(int insert_at, struct string_list *list, const char *string
>
> struct string_list_item *string_list_insert(struct string_list *list, const char *string)
> {
> - return string_list_insert_at_index(list, -1, string);
> -}
> -
> -struct string_list_item *string_list_insert_at_index(struct string_list *list,
> - int insert_at, const char *string)
> -{
> - int index = add_entry(insert_at, list, string);
> + int index = add_entry(-1, list, string);
>
> if (index < 0)
> index = -1 - index;
> diff --git a/string-list.h b/string-list.h
> index 40ffe0c..ee9b100 100644
> --- a/string-list.h
> +++ b/string-list.h
> @@ -61,8 +61,6 @@ int string_list_find_insert_index(const struct string_list *list, const char *st
> * Returns the string_list_item, the string is part of.
> */
> struct string_list_item *string_list_insert(struct string_list *list, const char *string);
> -struct string_list_item *string_list_insert_at_index(struct string_list *list,
> - int insert_at, const char *string);
>
> /*
> * Checks if the given string is part of a sorted list. If it is part of the list,
next prev parent reply other threads:[~2014-11-25 0:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-24 21:22 [PATCH 1/3] string_list: document string_list_(insert,lookup) Stefan Beller
2014-11-24 21:22 ` [PATCH 2/3] mailmap: use higher level string list functions Stefan Beller
2014-11-24 21:22 ` [PATCH 3/3] string_list: Remove string_list_insert_at_index from its API Stefan Beller
2014-11-25 0:25 ` Junio C Hamano [this message]
2014-11-25 1:16 ` Stefan Beller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq7fykunvs.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=julian@quantumfyre.co.uk \
--cc=marius@trolltech.com \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.