You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/11/23 16:26:05 UTC

[9/9] lucy-clownfish git commit: Add comma after labeled params in sample code

Add comma after labeled params in sample code


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/d2029d76
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/d2029d76
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/d2029d76

Branch: refs/heads/master
Commit: d2029d7615515f6b1b3c752de4fbdefd3e2b7aff
Parents: b92bf13
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Nov 23 16:29:15 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Nov 23 16:34:18 2016 +0100

----------------------------------------------------------------------
 compiler/src/CFCPerlPod.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/d2029d76/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index f096030..0d1ca0b 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -487,9 +487,10 @@ S_gen_labeled_sample(const char *prologue, CFCParamList *param_list,
     char *params = CFCUtil_strdup("");
 
     for (int i = start; i < num_vars; i++) {
-        const char *name    = CFCVariable_get_name(vars[i]);
-        const char *init    = inits[i];
-        char       *comment = NULL;
+        const char *name            = CFCVariable_get_name(vars[i]);
+        const char *init            = inits[i];
+        char       *name_with_comma = CFCUtil_sprintf("%s,", name);
+        char       *comment         = NULL;
 
         if (init) {
             if (strcmp(init, "NULL") == 0) { init = "undef"; }
@@ -501,11 +502,12 @@ S_gen_labeled_sample(const char *prologue, CFCParamList *param_list,
 
         char *line = CFCUtil_sprintf("        %-*s => $%-*s  # %s\n",
                                      (int)max_name_len, name,
-                                     (int)max_name_len, name,
+                                     (int)max_name_len + 1, name_with_comma,
                                      comment);
         params = CFCUtil_cat(params, line, NULL);
         FREEMEM(line);
         FREEMEM(comment);
+        FREEMEM(name_with_comma);
     }
 
     const char pattern[] =