Skip to content
  • Jeff King's avatar
    argv-array: refactor empty_argv initialization · fd93d2e6
    Jeff King authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    An empty argv-array is initialized to point to a static
    empty NULL-terminated array.  The original implementation
    separates the actual storage of the NULL-terminator from the
    pointer to the list.  This makes the exposed type a "const
    char **", which nicely matches the type stored by the
    argv-array.
    
    However, this indirection means that one cannot use
    empty_argv to initialize a static variable, since it is
    not a constant.
    
    Instead, we can expose empty_argv directly, as an array of
    pointers. The only place we use it is in the ARGV_ARRAY_INIT
    initializer, and it decays to a pointer appropriately there.
    
    Signed-off-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    fd93d2e6