@@ -67,7 +67,7 @@ static int show_origin;
6767 { OPTION_CALLBACK, (s), (l), (v), NULL, (h), PARSE_OPT_NOARG | \
6868 PARSE_OPT_NONEG, option_parse_type, (i) }
6969
70- static struct option builtin_config_options [] ;
70+ static NORETURN void usage_builtin_config ( void ) ;
7171
7272static int option_parse_type (const struct option * opt , const char * arg ,
7373 int unset )
@@ -111,8 +111,7 @@ static int option_parse_type(const struct option *opt, const char *arg,
111111 * --type=int'.
112112 */
113113 error ("only one type at a time." );
114- usage_with_options (builtin_config_usage ,
115- builtin_config_options );
114+ usage_builtin_config ();
116115 }
117116 * to_type = new_type ;
118117
@@ -157,11 +156,16 @@ static struct option builtin_config_options[] = {
157156 OPT_END (),
158157};
159158
159+ static NORETURN void usage_builtin_config (void )
160+ {
161+ usage_with_options (builtin_config_usage , builtin_config_options );
162+ }
163+
160164static void check_argc (int argc , int min , int max ) {
161165 if (argc >= min && argc <= max )
162166 return ;
163167 error ("wrong number of arguments" );
164- usage_with_options ( builtin_config_usage , builtin_config_options );
168+ usage_builtin_config ( );
165169}
166170
167171static void show_config_origin (struct strbuf * buf )
@@ -596,7 +600,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
596600 if (use_global_config + use_system_config + use_local_config +
597601 !!given_config_source .file + !!given_config_source .blob > 1 ) {
598602 error ("only one config file at a time." );
599- usage_with_options ( builtin_config_usage , builtin_config_options );
603+ usage_builtin_config ( );
600604 }
601605
602606 if (use_local_config && nongit )
@@ -660,38 +664,37 @@ int cmd_config(int argc, const char **argv, const char *prefix)
660664
661665 if ((actions & (ACTION_GET_COLOR |ACTION_GET_COLORBOOL )) && type ) {
662666 error ("--get-color and variable type are incoherent" );
663- usage_with_options ( builtin_config_usage , builtin_config_options );
667+ usage_builtin_config ( );
664668 }
665669
666670 if (HAS_MULTI_BITS (actions )) {
667671 error ("only one action at a time." );
668- usage_with_options ( builtin_config_usage , builtin_config_options );
672+ usage_builtin_config ( );
669673 }
670674 if (actions == 0 )
671675 switch (argc ) {
672676 case 1 : actions = ACTION_GET ; break ;
673677 case 2 : actions = ACTION_SET ; break ;
674678 case 3 : actions = ACTION_SET_ALL ; break ;
675679 default :
676- usage_with_options ( builtin_config_usage , builtin_config_options );
680+ usage_builtin_config ( );
677681 }
678682 if (omit_values &&
679683 !(actions == ACTION_LIST || actions == ACTION_GET_REGEXP )) {
680684 error ("--name-only is only applicable to --list or --get-regexp" );
681- usage_with_options ( builtin_config_usage , builtin_config_options );
685+ usage_builtin_config ( );
682686 }
683687
684688 if (show_origin && !(actions &
685689 (ACTION_GET |ACTION_GET_ALL |ACTION_GET_REGEXP |ACTION_LIST ))) {
686690 error ("--show-origin is only applicable to --get, --get-all, "
687691 "--get-regexp, and --list." );
688- usage_with_options ( builtin_config_usage , builtin_config_options );
692+ usage_builtin_config ( );
689693 }
690694
691695 if (default_value && !(actions & ACTION_GET )) {
692696 error ("--default is only applicable to --get" );
693- usage_with_options (builtin_config_usage ,
694- builtin_config_options );
697+ usage_builtin_config ();
695698 }
696699
697700 if (actions & PAGING_ACTIONS )
0 commit comments