All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Two small comment fixes.
@ 2017-09-21 12:43 Han-Wen Nienhuys
  2017-09-21 12:43 ` [PATCH 1/2] Fix typo in submodule.h Han-Wen Nienhuys
  2017-09-21 12:43 ` [PATCH 2/2] Document the string_list structure Han-Wen Nienhuys
  0 siblings, 2 replies; 5+ messages in thread
From: Han-Wen Nienhuys @ 2017-09-21 12:43 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys, sbeller

Han-Wen Nienhuys (2):
  Fix typo in submodule.h
  Document the string_list structure

 string-list.h | 6 ++++++
 submodule.h   | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

--
2.14.1.821.g8fa685d3b7-goog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] Fix typo in submodule.h
  2017-09-21 12:43 [PATCH 0/2] Two small comment fixes Han-Wen Nienhuys
@ 2017-09-21 12:43 ` Han-Wen Nienhuys
  2017-09-21 12:43 ` [PATCH 2/2] Document the string_list structure Han-Wen Nienhuys
  1 sibling, 0 replies; 5+ messages in thread
From: Han-Wen Nienhuys @ 2017-09-21 12:43 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 submodule.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/submodule.h b/submodule.h
index 6b52133c8..f0da0277a 100644
--- a/submodule.h
+++ b/submodule.h
@@ -120,7 +120,7 @@ extern int submodule_move_head(const char *path,
 
 /*
  * Prepare the "env_array" parameter of a "struct child_process" for executing
- * a submodule by clearing any repo-specific envirionment variables, but
+ * a submodule by clearing any repo-specific environment variables, but
  * retaining any config in the environment.
  */
 extern void prepare_submodule_repo_env(struct argv_array *out);
-- 
2.14.1.821.g8fa685d3b7-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] Document the string_list structure
  2017-09-21 12:43 [PATCH 0/2] Two small comment fixes Han-Wen Nienhuys
  2017-09-21 12:43 ` [PATCH 1/2] Fix typo in submodule.h Han-Wen Nienhuys
@ 2017-09-21 12:43 ` Han-Wen Nienhuys
  2017-09-21 16:24   ` Jeff King
  2017-09-21 17:52   ` Brandon Williams
  1 sibling, 2 replies; 5+ messages in thread
From: Han-Wen Nienhuys @ 2017-09-21 12:43 UTC (permalink / raw)
  To: git; +Cc: Han-Wen Nienhuys

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 string-list.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/string-list.h b/string-list.h
index 29bfb7ae4..08b534166 100644
--- a/string-list.h
+++ b/string-list.h
@@ -8,6 +8,12 @@ struct string_list_item {
 
 typedef int (*compare_strings_fn)(const char *, const char *);
 
+/* A resizable array of strings. The strings are owned if
+ * 'strdup_strings' is set. It can be used as a sorted array, and a
+ * custom comparison may be given in 'cmp'. The field 'items[i].util'
+ * may be used to implement an array of pairs. In that case, the
+ * caller is responsible for managing memory pointed to by 'util'.
+ */
 struct string_list {
 	struct string_list_item *items;
 	unsigned int nr, alloc;
-- 
2.14.1.821.g8fa685d3b7-goog


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Document the string_list structure
  2017-09-21 12:43 ` [PATCH 2/2] Document the string_list structure Han-Wen Nienhuys
@ 2017-09-21 16:24   ` Jeff King
  2017-09-21 17:52   ` Brandon Williams
  1 sibling, 0 replies; 5+ messages in thread
From: Jeff King @ 2017-09-21 16:24 UTC (permalink / raw)
  To: Han-Wen Nienhuys; +Cc: git

On Thu, Sep 21, 2017 at 02:43:38PM +0200, Han-Wen Nienhuys wrote:

> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  string-list.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/string-list.h b/string-list.h
> index 29bfb7ae4..08b534166 100644
> --- a/string-list.h
> +++ b/string-list.h
> @@ -8,6 +8,12 @@ struct string_list_item {
>  
>  typedef int (*compare_strings_fn)(const char *, const char *);
>  
> +/* A resizable array of strings. The strings are owned if
> + * 'strdup_strings' is set. It can be used as a sorted array, and a
> + * custom comparison may be given in 'cmp'. The field 'items[i].util'
> + * may be used to implement an array of pairs. In that case, the
> + * caller is responsible for managing memory pointed to by 'util'.
> + */
>  struct string_list {
>  	struct string_list_item *items;
>  	unsigned int nr, alloc;

There's a considerable amount of documentation for string-list in
Documentation/technical/api-string-list.txt.

Perhaps we should look at migrating it into string-list.h, where it's
more likely to be found (and kept up to date). We did something similar
for strbuf.h a while back, and I think the result is much better. See
the commits in:

  git log bdfdaa4978^..d468fa2721

for an example.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] Document the string_list structure
  2017-09-21 12:43 ` [PATCH 2/2] Document the string_list structure Han-Wen Nienhuys
  2017-09-21 16:24   ` Jeff King
@ 2017-09-21 17:52   ` Brandon Williams
  1 sibling, 0 replies; 5+ messages in thread
From: Brandon Williams @ 2017-09-21 17:52 UTC (permalink / raw)
  To: Han-Wen Nienhuys; +Cc: git

On 09/21, Han-Wen Nienhuys wrote:
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  string-list.h | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/string-list.h b/string-list.h
> index 29bfb7ae4..08b534166 100644
> --- a/string-list.h
> +++ b/string-list.h
> @@ -8,6 +8,12 @@ struct string_list_item {
>  
>  typedef int (*compare_strings_fn)(const char *, const char *);
>  
> +/* A resizable array of strings. The strings are owned if

nit: the start of the comment block should be on its own line:

  /*
   * A resizable ...

> + * 'strdup_strings' is set. It can be used as a sorted array, and a
> + * custom comparison may be given in 'cmp'. The field 'items[i].util'
> + * may be used to implement an array of pairs. In that case, the
> + * caller is responsible for managing memory pointed to by 'util'.
> + */

The util field can be freed if 'free_util' is set when calling
string_list_clear() but yeah, in general the caller is managing that
memory especially if a complex free function is required (in the case of
allocating a struct with dynamically allocated fields to be stored in
the util feild).

Just pointing that out, and I'm happy with this and the previous patch.

>  struct string_list {
>  	struct string_list_item *items;
>  	unsigned int nr, alloc;
> -- 
> 2.14.1.821.g8fa685d3b7-goog
> 



-- 
Brandon Williams

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-09-21 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 12:43 [PATCH 0/2] Two small comment fixes Han-Wen Nienhuys
2017-09-21 12:43 ` [PATCH 1/2] Fix typo in submodule.h Han-Wen Nienhuys
2017-09-21 12:43 ` [PATCH 2/2] Document the string_list structure Han-Wen Nienhuys
2017-09-21 16:24   ` Jeff King
2017-09-21 17:52   ` Brandon Williams

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.