1313 * this version handles 64 bit numbers and so can hold values up to
1414 * $92,233,720,368,547,758.07.
1515 *
16- * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.74 2007/11/15 21:14:38 momjian Exp $
16+ * $PostgreSQL: pgsql/src/backend/utils/adt/cash.c,v 1.75 2007/11/23 19:54:39 momjian Exp $
1717 */
1818
1919#include "postgres.h"
@@ -83,7 +83,6 @@ num_word(Cash value)
8383else
8484sprintf (buf ,"%s hundred %s %s" ,
8585small [value /100 ],big [tu /10 ],small [tu %10 ]);
86-
8786}
8887else
8988{
@@ -185,7 +184,6 @@ cash_in(PG_FUNCTION_ARGS)
185184{
186185sgn = -1 ;
187186s ++ ;
188-
189187}
190188else if (* s == psymbol )
191189s ++ ;
@@ -221,12 +219,8 @@ cash_in(PG_FUNCTION_ARGS)
221219seen_dot = 1 ;
222220
223221}
224- /* "thousands" separator? then skip... */
225- else if (* s == ssymbol )
226- {
227-
228- }
229- else
222+ /* not "thousands" separator? */
223+ else if (* s != ssymbol )
230224{
231225/* round off */
232226if (isdigit ((unsignedchar )* s )&& * s >='5' )
@@ -275,10 +269,10 @@ cash_out(PG_FUNCTION_ARGS)
275269int minus = 0 ;
276270int count = LAST_DIGIT ;
277271int point_pos ;
278- int comma_position = 0 ;
272+ int ssymbol_position = 0 ;
279273int points ,
280274mon_group ;
281- char comma ;
275+ char ssymbol ;
282276const char * csymbol ,
283277* nsymbol ;
284278char dsymbol ;
@@ -299,7 +293,7 @@ cash_out(PG_FUNCTION_ARGS)
299293if (mon_group <=0 || mon_group > 6 )
300294mon_group = 3 ;
301295
302- comma = ((* lconvert -> mon_thousands_sep != '\0' ) ?* lconvert -> mon_thousands_sep :',' );
296+ ssymbol = ((* lconvert -> mon_thousands_sep != '\0' ) ?* lconvert -> mon_thousands_sep :',' );
303297convention = lconvert -> n_sign_posn ;
304298dsymbol = ((* lconvert -> mon_decimal_point != '\0' ) ?* lconvert -> mon_decimal_point :'.' );
305299csymbol = ((* lconvert -> currency_symbol != '\0' ) ?lconvert -> currency_symbol :"$" );
@@ -308,10 +302,10 @@ cash_out(PG_FUNCTION_ARGS)
308302point_pos = LAST_DIGIT - points ;
309303
310304/* allow more than three decimal points and separate them */
311- if (comma )
305+ if (ssymbol )
312306{
313307point_pos -= (points - 1 ) /mon_group ;
314- comma_position = point_pos % (mon_group + 1 );
308+ ssymbol_position = point_pos % (mon_group + 1 );
315309}
316310
317311/* we work with positive amounts and add the minus sign at the end */
@@ -329,8 +323,8 @@ cash_out(PG_FUNCTION_ARGS)
329323{
330324if (points && count == point_pos )
331325buf [count -- ]= dsymbol ;
332- else if (comma && count % (mon_group + 1 )== comma_position )
333- buf [count -- ]= comma ;
326+ else if (ssymbol && count % (mon_group + 1 )== ssymbol_position )
327+ buf [count -- ]= ssymbol ;
334328
335329buf [count -- ]= ((uint64 )value %10 )+ '0' ;
336330value = ((uint64 )value ) /10 ;