@@ -652,46 +652,34 @@ int git_parse_ulong(const char *value, unsigned long *ret)
652
652
NORETURN
653
653
static void die_bad_number (const char * name , const char * value )
654
654
{
655
+ const char * error_type = (errno == ERANGE )? _ ("out of range" ):_ ("invalid unit" );
656
+
655
657
if (!value )
656
658
value = "" ;
657
659
658
660
if (!(cf && cf -> name ))
659
- die (errno == ERANGE
660
- ? _ ("bad numeric config value '%s' for '%s': out of range" )
661
- : _ ("bad numeric config value '%s' for '%s': invalid unit" ),
662
- value , name );
661
+ die (_ ("bad numeric config value '%s' for '%s': %s" ),
662
+ value , name , error_type );
663
663
664
664
switch (cf -> origin_type ) {
665
665
case CONFIG_ORIGIN_BLOB :
666
- die (errno == ERANGE
667
- ? _ ("bad numeric config value '%s' for '%s' in blob %s: out of range" )
668
- : _ ("bad numeric config value '%s' for '%s' in blob %s: invalid unit" ),
669
- value , name , cf -> name );
666
+ die (_ ("bad numeric config value '%s' for '%s' in blob %s: %s" ),
667
+ value , name , cf -> name , error_type );
670
668
case CONFIG_ORIGIN_FILE :
671
- die (errno == ERANGE
672
- ? _ ("bad numeric config value '%s' for '%s' in file %s: out of range" )
673
- : _ ("bad numeric config value '%s' for '%s' in file %s: invalid unit" ),
674
- value , name , cf -> name );
669
+ die (_ ("bad numeric config value '%s' for '%s' in file %s: %s" ),
670
+ value , name , cf -> name , error_type );
675
671
case CONFIG_ORIGIN_STDIN :
676
- die (errno == ERANGE
677
- ? _ ("bad numeric config value '%s' for '%s' in standard input: out of range" )
678
- : _ ("bad numeric config value '%s' for '%s' in standard input: invalid unit" ),
679
- value , name );
672
+ die (_ ("bad numeric config value '%s' for '%s' in standard input: %s" ),
673
+ value , name , error_type );
680
674
case CONFIG_ORIGIN_SUBMODULE_BLOB :
681
- die (errno == ERANGE
682
- ? _ ("bad numeric config value '%s' for '%s' in submodule-blob %s: out of range" )
683
- : _ ("bad numeric config value '%s' for '%s' in submodule-blob %s: invalid unit" ),
684
- value , name , cf -> name );
675
+ die (_ ("bad numeric config value '%s' for '%s' in submodule-blob %s: %s" ),
676
+ value , name , cf -> name , error_type );
685
677
case CONFIG_ORIGIN_CMDLINE :
686
- die (errno == ERANGE
687
- ? _ ("bad numeric config value '%s' for '%s' in command line %s: out of range" )
688
- : _ ("bad numeric config value '%s' for '%s' in command line %s: invalid unit" ),
689
- value , name , cf -> name );
678
+ die (_ ("bad numeric config value '%s' for '%s' in command line %s: %s" ),
679
+ value , name , cf -> name , error_type );
690
680
default :
691
- die (errno == ERANGE
692
- ? _ ("bad numeric config value '%s' for '%s' in %s: out of range" )
693
- : _ ("bad numeric config value '%s' for '%s' in %s: invalid unit" ),
694
- value , name , cf -> name );
681
+ die (_ ("bad numeric config value '%s' for '%s' in %s: %s" ),
682
+ value , name , cf -> name , error_type );
695
683
}
696
684
}
697
685
0 commit comments