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

Commit71d0cab

Browse files
committed
Fix len so decimal length is only added when a period appears in the output.
1 parentaffcb43 commit71d0cab

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

‎src/bin/psql/print.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.70 2005/07/1818:58:45 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.71 2005/07/1819:27:37 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"common.h"
@@ -65,17 +65,18 @@ integer_digits(const char *my_str)
6565
staticint
6666
len_numericseps(constchar*my_str)
6767
{
68-
intint_len=integer_digits(my_str),sep_len;
68+
intint_len=integer_digits(my_str),len=0;
6969
intgroupdigits=atoi(grouping);
7070

71-
if (int_len==0)
72-
sep_len=0;
73-
else
71+
if (int_len>0)
7472
/* Don't count a leading separator */
75-
sep_len=int_len /groupdigits- (int_len %groupdigits==0);
73+
len= (int_len /groupdigits- (int_len %groupdigits==0))*
74+
strlen(thousands_sep);
7675

77-
returnsep_len*strlen(thousands_sep)-
78-
strlen(".")+strlen(decimal_point);
76+
if (strchr(my_str,'.')!=NULL)
77+
len+=strlen(decimal_point)-strlen(".");
78+
79+
returnlen;
7980
}
8081

8182
staticint

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp