11/* -----------------------------------------------------------------------
22 * formatting.c
33 *
4- * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.108 2006/03/05 15:58:42 momjian Exp $
4+ * $PostgreSQL: pgsql/src/backend/utils/adt/formatting.c,v 1.109 2006/04/19 14:48:06 momjian Exp $
55 *
66 *
77 * Portions Copyright (c) 1999-2006, PostgreSQL Global Development Group
@@ -1096,7 +1096,6 @@ NUMDesc_prepare(NUMDesc *num, FormatNode *n)
10961096 num -> pre_lsign_num = num -> pre ;
10971097 num -> need_locale = TRUE;
10981098 num -> flag |= NUM_F_LSIGN ;
1099-
11001099 }
11011100 else if (num -> lsign == NUM_LSIGN_NONE )
11021101 {
@@ -1228,7 +1227,6 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
12281227 */
12291228 if (* str && (n -> key = index_seq_search (str , kw , index )) != NULL )
12301229 {
1231-
12321230 n -> type = NODE_TYPE_ACTION ;
12331231 n -> suffix = 0 ;
12341232 node_set = 1 ;
@@ -1250,7 +1248,6 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
12501248 if (s -> len )
12511249 str += s -> len ;
12521250 }
1253-
12541251 }
12551252 else if (* str )
12561253 {
@@ -1259,7 +1256,6 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
12591256 */
12601257 if (* str == '"' && last != '\\' )
12611258 {
1262-
12631259 int x = 0 ;
12641260
12651261 while (* (++ str ))
@@ -1284,13 +1280,11 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
12841280 node_set = 0 ;
12851281 suffix = 0 ;
12861282 last = 0 ;
1287-
12881283 }
12891284 else if (* str && * str == '\\' && last != '\\' && * (str + 1 ) == '"' )
12901285 {
12911286 last = * str ;
12921287 str ++ ;
1293-
12941288 }
12951289 else if (* str )
12961290 {
@@ -1301,7 +1295,6 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
13011295 last = 0 ;
13021296 str ++ ;
13031297 }
1304-
13051298 }
13061299
13071300 /* end */
@@ -1314,7 +1307,6 @@ parse_format(FormatNode *node, char *str, const KeyWord *kw,
13141307 n -> suffix = 0 ;
13151308 node_set = 0 ;
13161309 }
1317-
13181310 }
13191311
13201312 n -> type = NODE_TYPE_END ;
@@ -1422,7 +1414,6 @@ dump_node(FormatNode *node, int max)
14221414 }
14231415 else
14241416 elog (DEBUG_elog_output , "%d:\t unknown NODE!" , a );
1425-
14261417 }
14271418}
14281419#endif /* DEBUG */
@@ -1558,14 +1549,12 @@ seq_search(char *name, char **array, int type, int max, int *len)
15581549
15591550 for (last = 0 , a = array ; * a != NULL ; a ++ )
15601551 {
1561-
15621552 /* comperate first chars */
15631553 if (* name != * * a )
15641554 continue ;
15651555
15661556 for (i = 1 , p = * a + 1 , n = name + 1 ;; n ++ , p ++ , i ++ )
15671557 {
1568-
15691558 /* search fragment (max) only */
15701559 if (max && i == max )
15711560 {
@@ -2703,7 +2692,6 @@ DCH_cache_getnew(char *str)
27032692 */
27042693 if (n_DCHCache > DCH_CACHE_FIELDS )
27052694 {
2706-
27072695 DCHCacheEntry * old = DCHCache + 0 ;
27082696
27092697#ifdef DEBUG_TO_FROM_CHAR
@@ -3226,7 +3214,6 @@ do_to_timestamp(text *date_txt, text *fmt,
32263214
32273215 if ((ent = DCH_cache_search (fmt_str )) == NULL )
32283216 {
3229-
32303217 ent = DCH_cache_getnew (fmt_str );
32313218
32323219 /*
@@ -3475,7 +3462,6 @@ NUM_cache_getnew(char *str)
34753462 */
34763463 if (n_NUMCache > NUM_CACHE_FIELDS )
34773464 {
3478-
34793465 NUMCacheEntry * old = NUMCache + 0 ;
34803466
34813467#ifdef DEBUG_TO_FROM_CHAR
@@ -3503,7 +3489,6 @@ NUM_cache_getnew(char *str)
35033489 old -> age = (++ NUMCounter );
35043490
35053491 ent = old ;
3506-
35073492 }
35083493 else
35093494 {
@@ -3598,7 +3583,6 @@ NUM_cache(int len, NUMDesc *Num, char *pars_str, bool *shouldFree)
35983583 NULL , NUM_index , NUM_TYPE , Num );
35993584
36003585 (format + len )-> type = NODE_TYPE_END ; /* Paranoia? */
3601-
36023586 }
36033587 else
36043588 {
@@ -3611,7 +3595,6 @@ NUM_cache(int len, NUMDesc *Num, char *pars_str, bool *shouldFree)
36113595
36123596 if ((ent = NUM_cache_search (str )) == NULL )
36133597 {
3614-
36153598 ent = NUM_cache_getnew (str );
36163599
36173600 /*
@@ -3622,7 +3605,6 @@ NUM_cache(int len, NUMDesc *Num, char *pars_str, bool *shouldFree)
36223605 NULL , NUM_index , NUM_TYPE , & ent -> Num );
36233606
36243607 (ent -> format + len )-> type = NODE_TYPE_END ; /* Paranoia? */
3625-
36263608 }
36273609
36283610 format = ent -> format ;
@@ -3705,7 +3687,6 @@ NUM_prepare_locale(NUMProc *Np)
37053687{
37063688 if (Np -> Num -> need_locale )
37073689 {
3708-
37093690 struct lconv * lconv ;
37103691
37113692 /*
@@ -3829,7 +3810,6 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
38293810 if (* Np -> number == ' ' && (id == NUM_0 || id == NUM_9 ) &&
38303811 (Np -> read_pre + Np -> read_post ) == 0 )
38313812 {
3832-
38333813#ifdef DEBUG_TO_FROM_CHAR
38343814 elog (DEBUG_elog_output , "Try read sign (%c), locale positive: %s, negative: %s" ,
38353815 * Np -> inout_p , Np -> L_positive_sign , Np -> L_negative_sign );
@@ -3872,14 +3852,11 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
38723852 if (* Np -> inout_p == '-' || (IS_BRACKET (Np -> Num ) &&
38733853 * Np -> inout_p == '<' ))
38743854 {
3875-
38763855 * Np -> number = '-' ; /* set - */
38773856 Np -> inout_p ++ ;
3878-
38793857 }
38803858 else if (* Np -> inout_p == '+' )
38813859 {
3882-
38833860 * Np -> number = '+' ; /* set + */
38843861 Np -> inout_p ++ ;
38853862 }
@@ -3898,7 +3875,6 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
38983875 */
38993876 if (isdigit ((unsigned char ) * Np -> inout_p ))
39003877 {
3901-
39023878 if (Np -> read_dec && Np -> read_post == Np -> Num -> post )
39033879 return ;
39043880
@@ -3922,13 +3898,11 @@ NUM_numpart_from_char(NUMProc *Np, int id, int plen)
39223898 }
39233899 else if (IS_DECIMAL (Np -> Num ) && Np -> read_dec == FALSE)
39243900 {
3925-
39263901#ifdef DEBUG_TO_FROM_CHAR
39273902 elog (DEBUG_elog_output , "Try read decimal point (%c)" , * Np -> inout_p );
39283903#endif
39293904 if (* Np -> inout_p == '.' )
39303905 {
3931-
39323906 * Np -> number_p = '.' ;
39333907 Np -> number_p ++ ;
39343908 Np -> read_dec = TRUE;
@@ -4123,7 +4097,6 @@ NUM_numpart_to_char(NUMProc *Np, int id)
41234097 * Np -> inout_p = ' ' ; /* Write ' ' */
41244098 ++ Np -> inout_p ;
41254099 }
4126-
41274100 }
41284101 else if (IS_ZERO (Np -> Num ) &&
41294102 Np -> num_curr < Np -> num_pre &&
@@ -4135,7 +4108,6 @@ NUM_numpart_to_char(NUMProc *Np, int id)
41354108 * Np -> inout_p = '0' ; /* Write '0' */
41364109 ++ Np -> inout_p ;
41374110 Np -> num_in = TRUE;
4138-
41394111 }
41404112 else
41414113 {
@@ -4144,7 +4116,6 @@ NUM_numpart_to_char(NUMProc *Np, int id)
41444116 */
41454117 if (* Np -> number_p == '.' )
41464118 {
4147-
41484119 if (!Np -> last_relevant || * Np -> last_relevant != '.' )
41494120 {
41504121 strcpy (Np -> inout_p , Np -> decimal ); /* Write DEC/D */
@@ -4157,11 +4128,9 @@ NUM_numpart_to_char(NUMProc *Np, int id)
41574128 else if (IS_FILLMODE (Np -> Num ) &&
41584129 Np -> last_relevant && * Np -> last_relevant == '.' )
41594130 {
4160-
41614131 strcpy (Np -> inout_p , Np -> decimal ); /* Write DEC/D */
41624132 Np -> inout_p += strlen (Np -> inout_p );
41634133 }
4164-
41654134 }
41664135 else
41674136 {
@@ -4408,7 +4377,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
44084377 */
44094378 switch (n -> key -> id )
44104379 {
4411-
44124380 case NUM_9 :
44134381 case NUM_0 :
44144382 case NUM_DEC :
@@ -4467,7 +4435,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
44674435 strcpy (Np -> inout_p , Np -> L_thousands_sep );
44684436 Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
44694437 }
4470-
44714438 }
44724439 else
44734440 {
@@ -4485,7 +4452,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
44854452 {
44864453 strcpy (Np -> inout_p , Np -> L_currency_symbol );
44874454 Np -> inout_p += strlen (Np -> inout_p ) - 1 ;
4488-
44894455 }
44904456 else
44914457 Np -> inout_p += strlen (Np -> L_currency_symbol ) - 1 ;
@@ -4546,7 +4512,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
45464512 continue ;
45474513 else
45484514 * Np -> inout_p = ' ' ;
4549-
45504515 }
45514516 else
45524517 {
@@ -4564,7 +4529,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
45644529 continue ;
45654530 else
45664531 * Np -> inout_p = ' ' ;
4567-
45684532 }
45694533 else
45704534 {
@@ -4591,7 +4555,6 @@ NUM_processor(FormatNode *node, NUMDesc *Num, char *inout, char *number,
45914555 continue ;
45924556 break ;
45934557 }
4594-
45954558 }
45964559 else
45974560 {
0 commit comments