From: Bruno Haible Date: Sun, 11 May 2025 21:50:45 +0000 (+0200) Subject: gen-uni-tables: Fix compilation error (regression 2025-01-03). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1b473d18cfdb65cea359f1d59cf1d3a61c226b3b;p=thirdparty%2Fgnulib.git gen-uni-tables: Fix compilation error (regression 2025-01-03). * lib/gen-uni-tables.c (str_startswith): New function, from lib/str_startswith.c. (str_endswith): New function, from lib/str_endswith.c. --- diff --git a/ChangeLog b/ChangeLog index 07a138a83f..68de92510f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2025-05-11 Bruno Haible + + gen-uni-tables: Fix compilation error (regression 2025-01-03). + * lib/gen-uni-tables.c (str_startswith): New function, from + lib/str_startswith.c. + (str_endswith): New function, from lib/str_endswith.c. + 2025-05-11 Bruno Haible HACKING: Add documentation regarding link dependencies. diff --git a/lib/gen-uni-tables.c b/lib/gen-uni-tables.c index 2bac68c2da..9f4496e20f 100644 --- a/lib/gen-uni-tables.c +++ b/lib/gen-uni-tables.c @@ -51,6 +51,24 @@ /* ========================================================================= */ +/* Utility functions. */ + +static bool +str_startswith (const char *string, const char *prefix) +{ + return strncmp (string, prefix, strlen (prefix)) == 0; +} + +static bool +str_endswith (const char *string, const char *suffix) +{ + size_t len = strlen (string); + size_t n = strlen (suffix); + return len >= n && strcmp (string + len - n, suffix) == 0; +} + +/* ========================================================================= */ + /* Reading UnicodeData.txt. */ /* See UCD.html. */