Merge branch 'jk/c99'
authorJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 20:26:58 +0000 (13:26 -0700)
Start using selected c99 constructs in small, stable and
essentialpart of the system to catch people who care about
older compilers that do not grok them.

* jk/c99:
clean.c: use designated initializer
strbuf: use designated initializers in STRBUF_INIT

1  2 
builtin/clean.c
diff --combined builtin/clean.c
index c1bafda5b63324b0aba7400535cc0ba745e46004,e2bb3c69ed4d0c65f05527f27e1505856688d16d..21a7a3299408ac507917ac13f9342e3148ac53ec
@@@ -33,15 -33,6 +33,6 @@@ static const char *msg_skip_git_dir = N
  static const char *msg_would_skip_git_dir = N_("Would skip repository %s\n");
  static const char *msg_warn_remove_failed = N_("failed to remove %s");
  
- static int clean_use_color = -1;
- static char clean_colors[][COLOR_MAXLEN] = {
-       GIT_COLOR_RESET,
-       GIT_COLOR_NORMAL,       /* PLAIN */
-       GIT_COLOR_BOLD_BLUE,    /* PROMPT */
-       GIT_COLOR_BOLD,         /* HEADER */
-       GIT_COLOR_BOLD_RED,     /* HELP */
-       GIT_COLOR_BOLD_RED,     /* ERROR */
- };
  enum color_clean {
        CLEAN_COLOR_RESET = 0,
        CLEAN_COLOR_PLAIN = 1,
        CLEAN_COLOR_ERROR = 5
  };
  
+ static int clean_use_color = -1;
+ static char clean_colors[][COLOR_MAXLEN] = {
+       [CLEAN_COLOR_ERROR] = GIT_COLOR_BOLD_RED,
+       [CLEAN_COLOR_HEADER] = GIT_COLOR_BOLD,
+       [CLEAN_COLOR_HELP] = GIT_COLOR_BOLD_RED,
+       [CLEAN_COLOR_PLAIN] = GIT_COLOR_NORMAL,
+       [CLEAN_COLOR_PROMPT] = GIT_COLOR_BOLD_BLUE,
+       [CLEAN_COLOR_RESET] = GIT_COLOR_RESET,
+ };
  #define MENU_OPTS_SINGLETON           01
  #define MENU_OPTS_IMMEDIATE           02
  #define MENU_OPTS_LIST_ONLY           04
@@@ -125,7 -126,8 +126,7 @@@ static int git_clean_config(const char 
                return 0;
        }
  
 -      /* inspect the color.ui config variable and others */
 -      return git_color_default_config(var, value, cb);
 +      return git_default_config(var, value, cb);
  }
  
  static const char *clean_get_color(enum color_clean ix)