@@ -1510,8 +1510,7 @@ static const char *
15101510get_th (char * num , int type )
15111511{
15121512 int len = strlen (num ),
1513- last ,
1514- seclast ;
1513+ last ;
15151514
15161515 last = * (num + (len - 1 ));
15171516 if (!isdigit ((unsigned char ) last ))
@@ -1523,7 +1522,7 @@ get_th(char *num, int type)
15231522 * All "teens" (<x>1[0-9]) get 'TH/th', while <x>[02-9][123] still get
15241523 * 'ST/st', 'ND/nd', 'RD/rd', respectively
15251524 */
1526- if ((len > 1 ) && (( seclast = num [len - 2 ]) == '1' ))
1525+ if ((len > 1 ) && (num [len - 2 ] == '1' ))
15271526 last = 0 ;
15281527
15291528 switch (last )
@@ -4932,9 +4931,9 @@ NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree)
49324931static char *
49334932int_to_roman (int number )
49344933{
4935- int len = 0 ,
4936- num = 0 ;
4937- char * p = NULL ,
4934+ int len ,
4935+ num ;
4936+ char * p ,
49384937 * result ,
49394938 numstr [12 ];
49404939
@@ -4950,7 +4949,7 @@ int_to_roman(int number)
49504949
49514950 for (p = numstr ; * p != '\0' ; p ++ , -- len )
49524951 {
4953- num = * p - 49 ; /* 48 ascii + 1 */
4952+ num = * p - ( '0' + 1 );
49544953 if (num < 0 )
49554954 continue ;
49564955
@@ -6118,7 +6117,7 @@ numeric_to_char(PG_FUNCTION_ARGS)
61186117 x = DatumGetNumeric (DirectFunctionCall2 (numeric_round ,
61196118 NumericGetDatum (value ),
61206119 Int32GetDatum (0 )));
6121- numstr = orgnum =
6120+ numstr =
61226121 int_to_roman (DatumGetInt32 (DirectFunctionCall1 (numeric_int4 ,
61236122 NumericGetDatum (x ))));
61246123 }
@@ -6239,7 +6238,7 @@ int4_to_char(PG_FUNCTION_ARGS)
62396238 * On DateType depend part (int32)
62406239 */
62416240 if (IS_ROMAN (& Num ))
6242- numstr = orgnum = int_to_roman (value );
6241+ numstr = int_to_roman (value );
62436242 else if (IS_EEEE (& Num ))
62446243 {
62456244 /* we can do it easily because float8 won't lose any precision */
@@ -6335,7 +6334,7 @@ int8_to_char(PG_FUNCTION_ARGS)
63356334 if (IS_ROMAN (& Num ))
63366335 {
63376336 /* Currently don't support int8 conversion to roman... */
6338- numstr = orgnum = int_to_roman (DatumGetInt32 (DirectFunctionCall1 (int84 , Int64GetDatum (value ))));
6337+ numstr = int_to_roman (DatumGetInt32 (DirectFunctionCall1 (int84 , Int64GetDatum (value ))));
63396338 }
63406339 else if (IS_EEEE (& Num ))
63416340 {
0 commit comments