Re: [PATCH v2 1/2] string-list: Add string_list initializer helper functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tanay Abhra <tanayabh@xxxxxxxxx> 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@xxxxxxxxx>
> ---


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]);

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]