Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit335d9af

Browse files
committed
Fix white space in MONEY type code. Rename 'comma' to more generic
'ssymbol' as used in previous function.
1 parentba2b2a2 commit335d9af

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

‎src/backend/utils/adt/cash.c

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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)
8383
else
8484
sprintf(buf,"%s hundred %s %s",
8585
small[value /100],big[tu /10],small[tu %10]);
86-
8786
}
8887
else
8988
{
@@ -185,7 +184,6 @@ cash_in(PG_FUNCTION_ARGS)
185184
{
186185
sgn=-1;
187186
s++;
188-
189187
}
190188
elseif (*s==psymbol)
191189
s++;
@@ -221,12 +219,8 @@ cash_in(PG_FUNCTION_ARGS)
221219
seen_dot=1;
222220

223221
}
224-
/* "thousands" separator? then skip... */
225-
elseif (*s==ssymbol)
226-
{
227-
228-
}
229-
else
222+
/* not "thousands" separator? */
223+
elseif (*s!=ssymbol)
230224
{
231225
/* round off */
232226
if (isdigit((unsignedchar)*s)&&*s >='5')
@@ -275,10 +269,10 @@ cash_out(PG_FUNCTION_ARGS)
275269
intminus=0;
276270
intcount=LAST_DIGIT;
277271
intpoint_pos;
278-
intcomma_position=0;
272+
intssymbol_position=0;
279273
intpoints,
280274
mon_group;
281-
charcomma;
275+
charssymbol;
282276
constchar*csymbol,
283277
*nsymbol;
284278
chardsymbol;
@@ -299,7 +293,7 @@ cash_out(PG_FUNCTION_ARGS)
299293
if (mon_group <=0||mon_group>6)
300294
mon_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 :',');
303297
convention=lconvert->n_sign_posn;
304298
dsymbol= ((*lconvert->mon_decimal_point!='\0') ?*lconvert->mon_decimal_point :'.');
305299
csymbol= ((*lconvert->currency_symbol!='\0') ?lconvert->currency_symbol :"$");
@@ -308,10 +302,10 @@ cash_out(PG_FUNCTION_ARGS)
308302
point_pos=LAST_DIGIT-points;
309303

310304
/* allow more than three decimal points and separate them */
311-
if (comma)
305+
if (ssymbol)
312306
{
313307
point_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
{
330324
if (points&&count==point_pos)
331325
buf[count--]=dsymbol;
332-
elseif (comma&&count % (mon_group+1)==comma_position)
333-
buf[count--]=comma;
326+
elseif (ssymbol&&count % (mon_group+1)==ssymbol_position)
327+
buf[count--]=ssymbol;
334328

335329
buf[count--]= ((uint64)value %10)+'0';
336330
value= ((uint64)value) /10;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp