summaryrefslogtreecommitdiffhomepage
path: root/src/utf8code.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-01-03 10:37:44 +0100
committerTyge Løvset <[email protected]>2023-01-03 10:37:44 +0100
commitc5abb5b806ddc3eedde2e6bcd31eef78c36edf33 (patch)
tree70198361b1133d7c6eb930c998eaaf6888d13309 /src/utf8code.c
parent16e004c62f8d8d502152a85b2ffd384a1c91a470 (diff)
downloadSTC-modified-c5abb5b806ddc3eedde2e6bcd31eef78c36edf33.tar.gz
STC-modified-c5abb5b806ddc3eedde2e6bcd31eef78c36edf33.zip
Fix compilation error in utf8code.c due to predeclaring a static array with unspecified size.
Diffstat (limited to 'src/utf8code.c')
-rw-r--r--src/utf8code.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/utf8code.c b/src/utf8code.c
index 4b657cc4..c4866b78 100644
--- a/src/utf8code.c
+++ b/src/utf8code.c
@@ -118,13 +118,11 @@ typedef struct {
} URange16;
typedef struct {
- const char *name;
const URange16 *r16;
int nr16;
} UGroup;
-static const UGroup unicode_groups[];
-static const int num_unicode_groups;
+static const UGroup unicode_groups[U8G_SIZE];
bool utf8_isgroup(int group, uint32_t c) {
for (int j=0; j<unicode_groups[group].nr16; ++j) {
@@ -163,6 +161,8 @@ bool utf8_isword(uint32_t c) {
utf8_isgroup(U8G_Nd, c) || utf8_isgroup(U8G_Pc, c) || utf8_isgroup(U8G_Nl, c);
}
+/* The tables below are extracted from the RE2 library */
+
static const URange16 Cc_range16[] = { // Control
{ 0, 31 },
{ 127, 159 },
@@ -328,9 +328,9 @@ static const URange16 Zs_range16[] = { // Space separator
};
#define UNI_ENTRY(Code) \
- { #Code, Code##_range16, sizeof(Code##_range16)/(2*2) }
+ { Code##_range16, sizeof(Code##_range16)/sizeof(URange16) }
-static const UGroup unicode_groups[] = {
+static const UGroup unicode_groups[U8G_SIZE] = {
[U8G_Cc] = UNI_ENTRY(Cc),
[U8G_Lt] = UNI_ENTRY(Lt),
[U8G_Nd] = UNI_ENTRY(Nd),
@@ -345,6 +345,4 @@ static const UGroup unicode_groups[] = {
[U8G_Zs] = UNI_ENTRY(Zs),
};
-static const int num_unicode_groups = sizeof unicode_groups / sizeof unicode_groups[0];
-
#endif