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

Commit2771fce

Browse files
committed
Fix issue with --enable-coverage and the new unicode {de,re}composition code
genhtml has been generating the following warning with this new code:WARNING: function data mismatch at /path/src/common/unicode_norm.c:102HTML coverage reports care about the uniqueness of functions defined insource files, ignoring any assumptions around CFLAGS.783f0ccintroduced a duplicated definition of get_code_entry(), leading to awarning and potentially some incorrect data generated in the reports.This refactors the code so as the code has only one functiondeclaration, fixing the warning.Oversight in783f0cc.Reported-by: Tom LaneAuthor: Michael PaquierReviewed-by: Tom LaneDiscussion:https://postgr.es/m/207789.1603469272@sss.pgh.pa.us
1 parent0b46e82 commit2771fce

File tree

1 file changed

+17
-21
lines changed

1 file changed

+17
-21
lines changed

‎src/common/unicode_norm.c

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,32 @@
4646
#defineNCOUNTVCOUNT * TCOUNT
4747
#defineSCOUNTLCOUNT * NCOUNT
4848

49+
#ifdefFRONTEND
50+
/* comparison routine for bsearch() of decomposition lookup table. */
51+
staticint
52+
conv_compare(constvoid*p1,constvoid*p2)
53+
{
54+
uint32v1,
55+
v2;
56+
57+
v1=*(constuint32*)p1;
58+
v2= ((constpg_unicode_decomposition*)p2)->codepoint;
59+
return (v1>v2) ?1 : ((v1==v2) ?0 :-1);
60+
}
61+
62+
#endif
63+
4964
/*
5065
* get_code_entry
5166
*
5267
* Get the entry corresponding to code in the decomposition lookup table.
5368
* The backend version of this code uses a perfect hash function for the
5469
* lookup, while the frontend version uses a binary search.
5570
*/
56-
#ifndefFRONTEND
57-
5871
staticconstpg_unicode_decomposition*
5972
get_code_entry(pg_wcharcode)
6073
{
74+
#ifndefFRONTEND
6175
inth;
6276
uint32hashkey;
6377
pg_unicode_decompinfodecompinfo=UnicodeDecompInfo;
@@ -82,33 +96,15 @@ get_code_entry(pg_wchar code)
8296

8397
/* Success! */
8498
return&decompinfo.decomps[h];
85-
}
86-
8799
#else
88-
89-
/* comparison routine for bsearch() of decomposition lookup table. */
90-
staticint
91-
conv_compare(constvoid*p1,constvoid*p2)
92-
{
93-
uint32v1,
94-
v2;
95-
96-
v1=*(constuint32*)p1;
97-
v2= ((constpg_unicode_decomposition*)p2)->codepoint;
98-
return (v1>v2) ?1 : ((v1==v2) ?0 :-1);
99-
}
100-
101-
staticconstpg_unicode_decomposition*
102-
get_code_entry(pg_wcharcode)
103-
{
104100
returnbsearch(&(code),
105101
UnicodeDecompMain,
106102
lengthof(UnicodeDecompMain),
107103
sizeof(pg_unicode_decomposition),
108104
conv_compare);
105+
#endif
109106
}
110107

111-
#endif/* !FRONTEND */
112108

113109
/*
114110
* Given a decomposition entry looked up earlier, get the decomposed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp