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

Commit2073c64

Browse files
committed
pg_test_timing: Some NLS fixes
The string "% of total" was marked by xgettext to be a c-format, but itis actually not, so mark up the source to prevent that.Compute the column widths of the final display dynamically based on thetranslated strings, so that translations don't mess up the displayaccidentally.
1 parenta772624 commit2073c64

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

‎src/bin/pg_test_timing/pg_test_timing.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,32 @@ output(uint64 loop_count)
172172
{
173173
int64max_bit=31,
174174
i;
175+
char*header1=_("< us");
176+
char*header2=/* xgettext:no-c-format */_("% of total");
177+
char*header3=_("count");
178+
intlen1=strlen(header1);
179+
intlen2=strlen(header2);
180+
intlen3=strlen(header3);
175181

176182
/* find highest bit value */
177183
while (max_bit>0&&histogram[max_bit]==0)
178184
max_bit--;
179185

180186
printf(_("Histogram of timing durations:\n"));
181-
printf("%6s %10s %10s\n",_("< us"),_("% of total"),_("count"));
187+
printf("%*s %*s %*s\n",
188+
Max(6,len1),header1,
189+
Max(10,len2),header2,
190+
Max(10,len3),header3);
182191

183192
for (i=0;i <=max_bit;i++)
184193
{
185194
charbuf[100];
186195

187196
/* lame hack to work around INT64_FORMAT deficiencies */
188197
snprintf(buf,sizeof(buf),INT64_FORMAT,histogram[i]);
189-
printf("%6ld %9.5f %10s\n",1l <<i,
190-
(double)histogram[i]*100 /loop_count,buf);
198+
printf("%*ld %*.5f %*s\n",
199+
Max(6,len1),1l <<i,
200+
Max(10,len2)-1, (double)histogram[i]*100 /loop_count,
201+
Max(10,len3),buf);
191202
}
192203
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp