]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gen-uni-tables: Fix compilation error (regression 2025-01-03).
authorBruno Haible <bruno@clisp.org>
Sun, 11 May 2025 21:50:45 +0000 (23:50 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 11 May 2025 21:52:46 +0000 (23:52 +0200)
* lib/gen-uni-tables.c (str_startswith): New function, from
lib/str_startswith.c.
(str_endswith): New function, from lib/str_endswith.c.

ChangeLog
lib/gen-uni-tables.c

index 07a138a83ff9667ea5566c2c74e4633d92c776d6..68de92510f28b8fa7e007ab49778583a93370c6e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2025-05-11  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        HACKING: Add documentation regarding link dependencies.
index 2bac68c2da5be7bf3b68e0316b0259a7576e82dd..9f4496e20f7f408f1d55989f726b91352dc1d57c 100644 (file)
 
 /* ========================================================================= */
 
+/* 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.  */