All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tanay Abhra <tanayabh@gmail.com>
Cc: git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
	Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>,
	Eric Sunshine <sunshine@sunshineco.com>
Subject: Re: [PATCH v2 1/2] string-list: Add string_list initializer helper functions
Date: Mon, 16 Jun 2014 15:59:05 -0700	[thread overview]
Message-ID: <xmqqsin4o406.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1402907232-24629-2-git-send-email-tanayabh@gmail.com> (Tanay Abhra's message of "Mon, 16 Jun 2014 01:27:11 -0700")

Tanay Abhra <tanayabh@gmail.com> writes:

> When a compound construct like a string_list within another
> struct is used, the default initializer macros are useless.
> For such cases add helper functions for string_list
> initialization for both DUP and NODUP modes.
>
> Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
> ---


Sorry, but I do not understand the above "useless".  Do you mean to
say that xyzzy below cannot be initialized that way?

 git.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/git.c b/git.c
index d261575..17714d1 100644
--- a/git.c
+++ b/git.c
@@ -595,11 +595,24 @@ static int run_argv(int *argcp, const char ***argv)
 }
 
 
+#include "string-list.h"
+
 int main(int argc, char **av)
 {
 	const char **argv = (const char **) av;
 	const char *cmd;
 
+	struct compound {
+		int frotz;
+		struct string_list nitfol;
+	} xyzzy = {
+		314,
+		STRING_LIST_INIT_DUP,
+	};
+	printf("dup-strings is set to %s\n",
+	       xyzzy.nitfol.strdup_strings ? "true" : "false");
+	return 0;
+
 	startup_info = &git_startup_info;
 
 	cmd = git_extract_argv0_path(argv[0]);

  reply	other threads:[~2014-06-16 22:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16  8:27 [PATCH v2 0/2] Git config cache & special querying api utilizing the cache Tanay Abhra
2014-06-16  8:27 ` [PATCH v2 1/2] string-list: Add string_list initializer helper functions Tanay Abhra
2014-06-16 22:59   ` Junio C Hamano [this message]
2014-06-17 19:05     ` Tanay Abhra
2014-06-17 22:10       ` Junio C Hamano
2014-06-16  8:27 ` [PATCH v2 2/2] config: Add hashtable for config parsing & retrieval Tanay Abhra
2014-06-16 17:11   ` Matthieu Moy
2014-06-16 17:28     ` Tanay Abhra
2014-06-16 17:35       ` Matthieu Moy
2014-06-17  5:34   ` Jeff King
2014-06-17  5:46     ` Jeff King

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=xmqqsin4o406.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    --cc=tanayabh@gmail.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.