Junio C Hamano <gits...@pobox.com> writes:

>> Commit ad24a30ef ("fast-export: add new --refspec option", 31-10-2013)
>> causes sparse to complain:
>>
>>       SP builtin/fast-export.c
>>   builtin/fast-export.c:739:55: warning: Variable length array is used.
>>
>> Do we want to use this C99 feature?
>
> Good eyes, and no---this needs to be fixed before going forward.
>
> Thanks for spotting.

I'm tempted to squash this in to the problematic commit, if nobody
comes up with a better fix soonish, before merging the series to
'next'.

 builtin/fast-export.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index 8ed41b4..7d02f63 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -736,9 +736,10 @@ int cmd_fast_export(int argc, const char **argv, const 
char *prefix)
                usage_with_options (fast_export_usage, options);
 
        if (refspecs_list.nr) {
-               const char *refspecs_str[refspecs_list.nr];
+               const char **refspecs_str;
                int i;
 
+               refspecs_str = xmalloc(sizeof(const char *) * refspecs_list.nr);
                for (i = 0; i < refspecs_list.nr; i++)
                        refspecs_str[i] = refspecs_list.items[i].string;
 
@@ -746,6 +747,7 @@ int cmd_fast_export(int argc, const char **argv, const char 
*prefix)
                refspecs = parse_fetch_refspec(refspecs_nr, refspecs_str);
 
                string_list_clear(&refspecs_list, 1);
+               free(refspecs_str);
        }
 
        if (use_done_feature)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to