[syslog-ng] [PATCH (3.4) 1/2] value-pairs: Update value_pairs_new_from_cmdline() to 3.4.

Gergely Nagy algernon at balabit.hu
Sun Jun 5 16:37:28 CEST 2011


A while ago the template functions were changed so that their argv[0]
became the template function's name.

What this means for value-pairs() is that we no longer need to play
dirty tricks with its argv[] to please g_option_context_parse(), which
expected the zero-index argument to be a program name.

Signed-off-by: Gergely Nagy <algernon at balabit.hu>
---
 lib/value-pairs.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/lib/value-pairs.c b/lib/value-pairs.c
index 10f3e57..c4e2542 100644
--- a/lib/value-pairs.c
+++ b/lib/value-pairs.c
@@ -430,7 +430,7 @@ vp_cmdline_parse_pair (const gchar *option_name, const gchar *value,
 
 ValuePairs *
 value_pairs_new_from_cmdline (GlobalConfig *cfg,
-			      gint cargc, gchar **cargv,
+			      gint argc, gchar **argv,
 			      GError **error)
 {
   ValuePairs *vp;
@@ -448,8 +448,6 @@ value_pairs_new_from_cmdline (GlobalConfig *cfg,
       NULL, NULL },
     { NULL }
   };
-  gchar **argv;
-  gint argc = cargc + 1;
   gint i;
   GOptionGroup *og;
   gpointer user_data_args[2];
@@ -458,12 +456,6 @@ value_pairs_new_from_cmdline (GlobalConfig *cfg,
   user_data_args[0] = cfg;
   user_data_args[1] = vp;
 
-  argv = g_new (gchar *, argc + 1);
-  for (i = 0; i < argc; i++)
-    argv[i + 1] = cargv[i];
-  argv[0] = "value-pairs";
-  argv[argc] = NULL;
-
   ctx = g_option_context_new ("value-pairs");
   og = g_option_group_new (NULL, NULL, NULL, user_data_args, NULL);
   g_option_group_add_entries (og, vp_options);
-- 
1.7.2.5



More information about the syslog-ng mailing list