Skip to content

Commit 2771fce

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:102 HTML coverage reports care about the uniqueness of functions defined in source files, ignoring any assumptions around CFLAGS. 783f0cc introduced a duplicated definition of get_code_entry(), leading to a warning and potentially some incorrect data generated in the reports. This refactors the code so as the code has only one function declaration, fixing the warning. Oversight in 783f0cc. Reported-by: Tom Lane Author: Michael Paquier Reviewed-by: Tom Lane Discussion: https://postgr.es/m/207789.1603469272@sss.pgh.pa.us
1 parent 0b46e82 commit 2771fce

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
#define NCOUNT VCOUNT * TCOUNT
4747
#define SCOUNT LCOUNT * NCOUNT
4848

49+
#ifdef FRONTEND
50+
/* comparison routine for bsearch() of decomposition lookup table. */
51+
static int
52+
conv_compare(const void *p1, const void *p2)
53+
{
54+
uint32 v1,
55+
v2;
56+
57+
v1 = *(const uint32 *) p1;
58+
v2 = ((const pg_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-
#ifndef FRONTEND
57-
5871
static const pg_unicode_decomposition *
5972
get_code_entry(pg_wchar code)
6073
{
74+
#ifndef FRONTEND
6175
int h;
6276
uint32 hashkey;
6377
pg_unicode_decompinfo decompinfo = 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-
static int
91-
conv_compare(const void *p1, const void *p2)
92-
{
93-
uint32 v1,
94-
v2;
95-
96-
v1 = *(const uint32 *) p1;
97-
v2 = ((const pg_unicode_decomposition *) p2)->codepoint;
98-
return (v1 > v2) ? 1 : ((v1 == v2) ? 0 : -1);
99-
}
100-
101-
static const pg_unicode_decomposition *
102-
get_code_entry(pg_wchar code)
103-
{
104100
return bsearch(&(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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy