summaryrefslogtreecommitdiff
path: root/lib/unistr
diff options
context:
space:
mode:
Diffstat (limited to 'lib/unistr')
-rw-r--r--lib/unistr/u-cmp2.h2
-rw-r--r--lib/unistr/u-cpy-alloc.h2
-rw-r--r--lib/unistr/u-cpy.h2
-rw-r--r--lib/unistr/u-endswith.h2
-rw-r--r--lib/unistr/u-move.h2
-rw-r--r--lib/unistr/u-pcpy.h2
-rw-r--r--lib/unistr/u-set.h2
-rw-r--r--lib/unistr/u-startswith.h2
-rw-r--r--lib/unistr/u-stpcpy.h2
-rw-r--r--lib/unistr/u-stpncpy.h2
-rw-r--r--lib/unistr/u-strcat.h2
-rw-r--r--lib/unistr/u-strcoll.h2
-rw-r--r--lib/unistr/u-strcpy.h2
-rw-r--r--lib/unistr/u-strcspn.h2
-rw-r--r--lib/unistr/u-strdup.h2
-rw-r--r--lib/unistr/u-strlen.h2
-rw-r--r--lib/unistr/u-strncat.h2
-rw-r--r--lib/unistr/u-strncpy.h2
-rw-r--r--lib/unistr/u-strnlen.h2
-rw-r--r--lib/unistr/u-strpbrk.h2
-rw-r--r--lib/unistr/u-strspn.h2
-rw-r--r--lib/unistr/u-strtok.h2
-rw-r--r--lib/unistr/u16-check.c5
-rw-r--r--lib/unistr/u16-chr.c41
-rw-r--r--lib/unistr/u16-cmp.c36
-rw-r--r--lib/unistr/u16-cmp2.c2
-rw-r--r--lib/unistr/u16-cpy-alloc.c2
-rw-r--r--lib/unistr/u16-cpy.c2
-rw-r--r--lib/unistr/u16-endswith.c2
-rw-r--r--lib/unistr/u16-mblen.c2
-rw-r--r--lib/unistr/u16-mbsnlen.c6
-rw-r--r--lib/unistr/u16-mbtouc-aux.c2
-rw-r--r--lib/unistr/u16-mbtouc-unsafe-aux.c2
-rw-r--r--lib/unistr/u16-mbtouc-unsafe.c2
-rw-r--r--lib/unistr/u16-mbtouc.c2
-rw-r--r--lib/unistr/u16-mbtoucr.c2
-rw-r--r--lib/unistr/u16-move.c2
-rw-r--r--lib/unistr/u16-next.c9
-rw-r--r--lib/unistr/u16-pcpy.c2
-rw-r--r--lib/unistr/u16-prev.c5
-rw-r--r--lib/unistr/u16-set.c2
-rw-r--r--lib/unistr/u16-startswith.c2
-rw-r--r--lib/unistr/u16-stpcpy.c2
-rw-r--r--lib/unistr/u16-stpncpy.c2
-rw-r--r--lib/unistr/u16-strcat.c2
-rw-r--r--lib/unistr/u16-strchr.c43
-rw-r--r--lib/unistr/u16-strcmp.c31
-rw-r--r--lib/unistr/u16-strcoll.c2
-rw-r--r--lib/unistr/u16-strcpy.c2
-rw-r--r--lib/unistr/u16-strcspn.c2
-rw-r--r--lib/unistr/u16-strdup.c2
-rw-r--r--lib/unistr/u16-strlen.c2
-rw-r--r--lib/unistr/u16-strmblen.c2
-rw-r--r--lib/unistr/u16-strmbtouc.c2
-rw-r--r--lib/unistr/u16-strncat.c2
-rw-r--r--lib/unistr/u16-strncmp.c36
-rw-r--r--lib/unistr/u16-strncpy.c2
-rw-r--r--lib/unistr/u16-strnlen.c2
-rw-r--r--lib/unistr/u16-strpbrk.c5
-rw-r--r--lib/unistr/u16-strrchr.c46
-rw-r--r--lib/unistr/u16-strspn.c2
-rw-r--r--lib/unistr/u16-strstr.c5
-rw-r--r--lib/unistr/u16-strtok.c2
-rw-r--r--lib/unistr/u16-to-u32.c22
-rw-r--r--lib/unistr/u16-to-u8.c22
-rw-r--r--lib/unistr/u16-uctomb-aux.c2
-rw-r--r--lib/unistr/u16-uctomb.c2
-rw-r--r--lib/unistr/u32-check.c5
-rw-r--r--lib/unistr/u32-chr.c5
-rw-r--r--lib/unistr/u32-cmp.c14
-rw-r--r--lib/unistr/u32-cmp2.c2
-rw-r--r--lib/unistr/u32-cpy-alloc.c2
-rw-r--r--lib/unistr/u32-cpy.c2
-rw-r--r--lib/unistr/u32-endswith.c2
-rw-r--r--lib/unistr/u32-mblen.c2
-rw-r--r--lib/unistr/u32-mbsnlen.c2
-rw-r--r--lib/unistr/u32-mbtouc-unsafe.c2
-rw-r--r--lib/unistr/u32-mbtouc.c2
-rw-r--r--lib/unistr/u32-mbtoucr.c2
-rw-r--r--lib/unistr/u32-move.c2
-rw-r--r--lib/unistr/u32-next.c9
-rw-r--r--lib/unistr/u32-pcpy.c2
-rw-r--r--lib/unistr/u32-prev.c5
-rw-r--r--lib/unistr/u32-set.c2
-rw-r--r--lib/unistr/u32-startswith.c2
-rw-r--r--lib/unistr/u32-stpcpy.c2
-rw-r--r--lib/unistr/u32-stpncpy.c2
-rw-r--r--lib/unistr/u32-strcat.c2
-rw-r--r--lib/unistr/u32-strchr.c5
-rw-r--r--lib/unistr/u32-strcmp.c13
-rw-r--r--lib/unistr/u32-strcoll.c2
-rw-r--r--lib/unistr/u32-strcpy.c2
-rw-r--r--lib/unistr/u32-strcspn.c2
-rw-r--r--lib/unistr/u32-strdup.c2
-rw-r--r--lib/unistr/u32-strlen.c2
-rw-r--r--lib/unistr/u32-strmblen.c2
-rw-r--r--lib/unistr/u32-strmbtouc.c2
-rw-r--r--lib/unistr/u32-strncat.c2
-rw-r--r--lib/unistr/u32-strncmp.c14
-rw-r--r--lib/unistr/u32-strncpy.c2
-rw-r--r--lib/unistr/u32-strnlen.c2
-rw-r--r--lib/unistr/u32-strpbrk.c5
-rw-r--r--lib/unistr/u32-strrchr.c5
-rw-r--r--lib/unistr/u32-strspn.c2
-rw-r--r--lib/unistr/u32-strstr.c5
-rw-r--r--lib/unistr/u32-strtok.c2
-rw-r--r--lib/unistr/u32-to-u16.c23
-rw-r--r--lib/unistr/u32-to-u8.c23
-rw-r--r--lib/unistr/u32-uctomb.c2
-rw-r--r--lib/unistr/u8-check.c5
-rw-r--r--lib/unistr/u8-chr.c8
-rw-r--r--lib/unistr/u8-cmp.c2
-rw-r--r--lib/unistr/u8-cmp2.c2
-rw-r--r--lib/unistr/u8-cpy-alloc.c2
-rw-r--r--lib/unistr/u8-cpy.c2
-rw-r--r--lib/unistr/u8-endswith.c2
-rw-r--r--lib/unistr/u8-mblen.c2
-rw-r--r--lib/unistr/u8-mbsnlen.c6
-rw-r--r--lib/unistr/u8-mbtouc-aux.c2
-rw-r--r--lib/unistr/u8-mbtouc-unsafe-aux.c2
-rw-r--r--lib/unistr/u8-mbtouc-unsafe.c2
-rw-r--r--lib/unistr/u8-mbtouc.c2
-rw-r--r--lib/unistr/u8-mbtoucr.c2
-rw-r--r--lib/unistr/u8-move.c2
-rw-r--r--lib/unistr/u8-next.c9
-rw-r--r--lib/unistr/u8-pcpy.c2
-rw-r--r--lib/unistr/u8-prev.c5
-rw-r--r--lib/unistr/u8-set.c2
-rw-r--r--lib/unistr/u8-startswith.c2
-rw-r--r--lib/unistr/u8-stpcpy.c2
-rw-r--r--lib/unistr/u8-stpncpy.c2
-rw-r--r--lib/unistr/u8-strcat.c2
-rw-r--r--lib/unistr/u8-strchr.c335
-rw-r--r--lib/unistr/u8-strcmp.c2
-rw-r--r--lib/unistr/u8-strcoll.c2
-rw-r--r--lib/unistr/u8-strcpy.c2
-rw-r--r--lib/unistr/u8-strcspn.c2
-rw-r--r--lib/unistr/u8-strdup.c2
-rw-r--r--lib/unistr/u8-strlen.c2
-rw-r--r--lib/unistr/u8-strmblen.c2
-rw-r--r--lib/unistr/u8-strmbtouc.c2
-rw-r--r--lib/unistr/u8-strncat.c2
-rw-r--r--lib/unistr/u8-strncmp.c2
-rw-r--r--lib/unistr/u8-strncpy.c2
-rw-r--r--lib/unistr/u8-strnlen.c2
-rw-r--r--lib/unistr/u8-strpbrk.c5
-rw-r--r--lib/unistr/u8-strrchr.c112
-rw-r--r--lib/unistr/u8-strspn.c2
-rw-r--r--lib/unistr/u8-strstr.c5
-rw-r--r--lib/unistr/u8-strtok.c2
-rw-r--r--lib/unistr/u8-to-u16.c22
-rw-r--r--lib/unistr/u8-to-u32.c22
-rw-r--r--lib/unistr/u8-uctomb-aux.c2
-rw-r--r--lib/unistr/u8-uctomb.c2
154 files changed, 625 insertions, 584 deletions
diff --git a/lib/unistr/u-cmp2.h b/lib/unistr/u-cmp2.h
index 8d5960b4..d5e80ca3 100644
--- a/lib/unistr/u-cmp2.h
+++ b/lib/unistr/u-cmp2.h
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-8/UTF-16/UTF-32 strings.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u-cpy-alloc.h b/lib/unistr/u-cpy-alloc.h
index ac225661..001ce16e 100644
--- a/lib/unistr/u-cpy-alloc.h
+++ b/lib/unistr/u-cpy-alloc.h
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u-cpy.h b/lib/unistr/u-cpy.h
index 4848c146..b683a4a2 100644
--- a/lib/unistr/u-cpy.h
+++ b/lib/unistr/u-cpy.h
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u-endswith.h b/lib/unistr/u-endswith.h
index 0c512ad9..36f0848b 100644
--- a/lib/unistr/u-endswith.h
+++ b/lib/unistr/u-endswith.h
@@ -1,5 +1,5 @@
/* Substring test for UTF-8/UTF-16/UTF-32 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-move.h b/lib/unistr/u-move.h
index 9aa36c41..3f1d1b78 100644
--- a/lib/unistr/u-move.h
+++ b/lib/unistr/u-move.h
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-pcpy.h b/lib/unistr/u-pcpy.h
index 81241975..1dd6437c 100644
--- a/lib/unistr/u-pcpy.h
+++ b/lib/unistr/u-pcpy.h
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8/16/32 string, return pointer after last written unit.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2023.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u-set.h b/lib/unistr/u-set.h
index 088cabef..22777c2f 100644
--- a/lib/unistr/u-set.h
+++ b/lib/unistr/u-set.h
@@ -1,5 +1,5 @@
/* Fill UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-startswith.h b/lib/unistr/u-startswith.h
index 8346c26c..5a849142 100644
--- a/lib/unistr/u-startswith.h
+++ b/lib/unistr/u-startswith.h
@@ -1,5 +1,5 @@
/* Substring test for UTF-8/UTF-16/UTF-32 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-stpcpy.h b/lib/unistr/u-stpcpy.h
index 22099ed7..30968f7b 100644
--- a/lib/unistr/u-stpcpy.h
+++ b/lib/unistr/u-stpcpy.h
@@ -1,5 +1,5 @@
/* Copy UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-stpncpy.h b/lib/unistr/u-stpncpy.h
index 2e532e07..4420b5cc 100644
--- a/lib/unistr/u-stpncpy.h
+++ b/lib/unistr/u-stpncpy.h
@@ -1,5 +1,5 @@
/* Copy UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strcat.h b/lib/unistr/u-strcat.h
index a4a4e931..3afb9cf2 100644
--- a/lib/unistr/u-strcat.h
+++ b/lib/unistr/u-strcat.h
@@ -1,5 +1,5 @@
/* Concatenate UTF-8/UTF-16/UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u-strcoll.h b/lib/unistr/u-strcoll.h
index e26eac08..8279e68c 100644
--- a/lib/unistr/u-strcoll.h
+++ b/lib/unistr/u-strcoll.h
@@ -1,6 +1,6 @@
/* Compare UTF-8/UTF-16/UTF-32 strings using the collation rules of the current
locale.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u-strcpy.h b/lib/unistr/u-strcpy.h
index 4151d1cc..fa948ad1 100644
--- a/lib/unistr/u-strcpy.h
+++ b/lib/unistr/u-strcpy.h
@@ -1,5 +1,5 @@
/* Copy UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strcspn.h b/lib/unistr/u-strcspn.h
index 3cca61c1..a12c4172 100644
--- a/lib/unistr/u-strcspn.h
+++ b/lib/unistr/u-strcspn.h
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strdup.h b/lib/unistr/u-strdup.h
index 978687b6..9b8e7b90 100644
--- a/lib/unistr/u-strdup.h
+++ b/lib/unistr/u-strdup.h
@@ -1,5 +1,5 @@
/* Copy UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u-strlen.h b/lib/unistr/u-strlen.h
index 03106a15..af2ed80f 100644
--- a/lib/unistr/u-strlen.h
+++ b/lib/unistr/u-strlen.h
@@ -1,5 +1,5 @@
/* Determine length of UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u-strncat.h b/lib/unistr/u-strncat.h
index 587960da..974ddca9 100644
--- a/lib/unistr/u-strncat.h
+++ b/lib/unistr/u-strncat.h
@@ -1,5 +1,5 @@
/* Concatenate UTF-8/UTF-16/UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strncpy.h b/lib/unistr/u-strncpy.h
index c59db653..12c46c60 100644
--- a/lib/unistr/u-strncpy.h
+++ b/lib/unistr/u-strncpy.h
@@ -1,5 +1,5 @@
/* Copy UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strnlen.h b/lib/unistr/u-strnlen.h
index 4ec1474f..3fb6e9b4 100644
--- a/lib/unistr/u-strnlen.h
+++ b/lib/unistr/u-strnlen.h
@@ -1,5 +1,5 @@
/* Determine bounded length of UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strpbrk.h b/lib/unistr/u-strpbrk.h
index c5f9d2de..a7dcca82 100644
--- a/lib/unistr/u-strpbrk.h
+++ b/lib/unistr/u-strpbrk.h
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strspn.h b/lib/unistr/u-strspn.h
index 021ffcfc..dcaac120 100644
--- a/lib/unistr/u-strspn.h
+++ b/lib/unistr/u-strspn.h
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u-strtok.h b/lib/unistr/u-strtok.h
index 823b545d..826d91e1 100644
--- a/lib/unistr/u-strtok.h
+++ b/lib/unistr/u-strtok.h
@@ -1,5 +1,5 @@
/* Tokenize UTF-8/UTF-16/UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-check.c b/lib/unistr/u16-check.c
index 9372236e..facf858e 100644
--- a/lib/unistr/u16-check.c
+++ b/lib/unistr/u16-check.c
@@ -1,5 +1,5 @@
/* Check UTF-16 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u16-chr.c b/lib/unistr/u16-chr.c
index fa46cfb1..75d75dfc 100644
--- a/lib/unistr/u16-chr.c
+++ b/lib/unistr/u16-chr.c
@@ -1,5 +1,5 @@
/* Search character in piece of UTF-16 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -32,8 +35,6 @@
uint16_t *
u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
{
- uint16_t c[2];
-
if (uc < 0x10000)
{
uint16_t c0 = uc;
@@ -45,21 +46,25 @@ u16_chr (const uint16_t *s, size_t n, ucs4_t uc)
}
}
else
- switch (u16_uctomb_aux (c, uc, 2))
- {
- case 2:
- if (n > 1)
- {
- uint16_t c0 = c[0];
- uint16_t c1 = c[1];
+ {
+ uint16_t c[2];
- for (n--; n > 0; s++, n--)
- {
- if (*s == c0 && s[1] == c1)
- return (uint16_t *) s;
- }
- }
- break;
- }
+ switch (u16_uctomb_aux (c, uc, 2))
+ {
+ case 2:
+ if (n > 1)
+ {
+ uint16_t c0 = c[0];
+ uint16_t c1 = c[1];
+
+ for (n--; n > 0; s++, n--)
+ {
+ if (*s == c0 && s[1] == c1)
+ return (uint16_t *) s;
+ }
+ }
+ break;
+ }
+ }
return NULL;
}
diff --git a/lib/unistr/u16-cmp.c b/lib/unistr/u16-cmp.c
index 1a27f5d3..8ebe5d22 100644
--- a/lib/unistr/u16-cmp.c
+++ b/lib/unistr/u16-cmp.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -34,29 +34,27 @@ u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n)
/* Note that the UTF-16 encoding does NOT preserve lexicographic order.
Namely, if uc1 is a 16-bit character and [uc2a,uc2b] is a surrogate pair,
we must enforce uc1 < [uc2a,uc2b], even if uc1 > uc2a. */
- for (; n > 0;)
+ for (; n > 0; n--)
{
uint16_t c1 = *s1++;
uint16_t c2 = *s2++;
- if (c1 == c2)
+ if (c1 != c2)
{
- n--;
- continue;
+ if (c1 < 0xd800 || c1 >= 0xe000)
+ {
+ if (!(c2 < 0xd800 || c2 >= 0xe000))
+ /* c2 is a surrogate, but c1 is not. */
+ return -1;
+ }
+ else
+ {
+ if (c2 < 0xd800 || c2 >= 0xe000)
+ /* c1 is a surrogate, but c2 is not. */
+ return 1;
+ }
+ return (int)c1 - (int)c2;
+ /* > 0 if c1 > c2, < 0 if c1 < c2. */
}
- if (c1 < 0xd800 || c1 >= 0xe000)
- {
- if (!(c2 < 0xd800 || c2 >= 0xe000))
- /* c2 is a surrogate, but c1 is not. */
- return -1;
- }
- else
- {
- if (c2 < 0xd800 || c2 >= 0xe000)
- /* c1 is a surrogate, but c2 is not. */
- return 1;
- }
- return (int)c1 - (int)c2;
- /* > 0 if c1 > c2, < 0 if c1 < c2. */
}
return 0;
}
diff --git a/lib/unistr/u16-cmp2.c b/lib/unistr/u16-cmp2.c
index bb53fef2..27259e86 100644
--- a/lib/unistr/u16-cmp2.c
+++ b/lib/unistr/u16-cmp2.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-16 strings.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u16-cpy-alloc.c b/lib/unistr/u16-cpy-alloc.c
index a7259d7b..c3cc36ec 100644
--- a/lib/unistr/u16-cpy-alloc.c
+++ b/lib/unistr/u16-cpy-alloc.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-cpy.c b/lib/unistr/u16-cpy.c
index 0c61d33d..b8632273 100644
--- a/lib/unistr/u16-cpy.c
+++ b/lib/unistr/u16-cpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-endswith.c b/lib/unistr/u16-endswith.c
index b12105d1..55f80578 100644
--- a/lib/unistr/u16-endswith.c
+++ b/lib/unistr/u16-endswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-16 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-mblen.c b/lib/unistr/u16-mblen.c
index e29d3c07..0082594a 100644
--- a/lib/unistr/u16-mblen.c
+++ b/lib/unistr/u16-mblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u16-mbsnlen.c b/lib/unistr/u16-mbsnlen.c
index 3a074507..211df43c 100644
--- a/lib/unistr/u16-mbsnlen.c
+++ b/lib/unistr/u16-mbsnlen.c
@@ -1,5 +1,5 @@
/* Count characters in UTF-16 string.
- Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This file is free software.
@@ -31,9 +31,7 @@
size_t
u16_mbsnlen (const uint16_t *s, size_t n)
{
- size_t characters;
-
- characters = 0;
+ size_t characters = 0;
while (n > 0)
{
ucs4_t uc;
diff --git a/lib/unistr/u16-mbtouc-aux.c b/lib/unistr/u16-mbtouc-aux.c
index f6ca667c..4748141d 100644
--- a/lib/unistr/u16-mbtouc-aux.c
+++ b/lib/unistr/u16-mbtouc-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-16 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software.
diff --git a/lib/unistr/u16-mbtouc-unsafe-aux.c b/lib/unistr/u16-mbtouc-unsafe-aux.c
index 44f68229..4c2b9cf4 100644
--- a/lib/unistr/u16-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u16-mbtouc-unsafe-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-16 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software.
diff --git a/lib/unistr/u16-mbtouc-unsafe.c b/lib/unistr/u16-mbtouc-unsafe.c
index 3d5f8289..4f015ac5 100644
--- a/lib/unistr/u16-mbtouc-unsafe.c
+++ b/lib/unistr/u16-mbtouc-unsafe.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software.
diff --git a/lib/unistr/u16-mbtouc.c b/lib/unistr/u16-mbtouc.c
index e6fad1c8..37debe0b 100644
--- a/lib/unistr/u16-mbtouc.c
+++ b/lib/unistr/u16-mbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software.
diff --git a/lib/unistr/u16-mbtoucr.c b/lib/unistr/u16-mbtoucr.c
index b0340227..6abfe551 100644
--- a/lib/unistr/u16-mbtoucr.c
+++ b/lib/unistr/u16-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string, returning an error code.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u16-move.c b/lib/unistr/u16-move.c
index 680ac997..cdef80b0 100644
--- a/lib/unistr/u16-move.c
+++ b/lib/unistr/u16-move.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-next.c b/lib/unistr/u16-next.c
index c4307681..e2cc035b 100644
--- a/lib/unistr/u16-next.c
+++ b/lib/unistr/u16-next.c
@@ -1,5 +1,5 @@
/* Iterate over next character in UTF-16 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -31,9 +34,7 @@
const uint16_t *
u16_next (ucs4_t *puc, const uint16_t *s)
{
- int count;
-
- count = u16_strmbtouc (puc, s);
+ int count = u16_strmbtouc (puc, s);
if (count > 0)
return s + count;
else
diff --git a/lib/unistr/u16-pcpy.c b/lib/unistr/u16-pcpy.c
index 9ed2c9dc..fd1f9ac4 100644
--- a/lib/unistr/u16-pcpy.c
+++ b/lib/unistr/u16-pcpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-16 string, return pointer after last written unit.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2023.
This file is free software.
diff --git a/lib/unistr/u16-prev.c b/lib/unistr/u16-prev.c
index 38032708..b49a8e81 100644
--- a/lib/unistr/u16-prev.c
+++ b/lib/unistr/u16-prev.c
@@ -1,5 +1,5 @@
/* Iterate over previous character in UTF-16 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u16-set.c b/lib/unistr/u16-set.c
index ee4c4d08..04d2ca2d 100644
--- a/lib/unistr/u16-set.c
+++ b/lib/unistr/u16-set.c
@@ -1,5 +1,5 @@
/* Fill UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-startswith.c b/lib/unistr/u16-startswith.c
index 748ecc51..19769a08 100644
--- a/lib/unistr/u16-startswith.c
+++ b/lib/unistr/u16-startswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-16 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-stpcpy.c b/lib/unistr/u16-stpcpy.c
index 268d44e7..49abec53 100644
--- a/lib/unistr/u16-stpcpy.c
+++ b/lib/unistr/u16-stpcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-16 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u16-stpncpy.c b/lib/unistr/u16-stpncpy.c
index 33793a0f..6d9bfd70 100644
--- a/lib/unistr/u16-stpncpy.c
+++ b/lib/unistr/u16-stpncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strcat.c b/lib/unistr/u16-strcat.c
index e3aac729..64d525c3 100644
--- a/lib/unistr/u16-strcat.c
+++ b/lib/unistr/u16-strcat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strchr.c b/lib/unistr/u16-strchr.c
index fe42999e..4a533b0f 100644
--- a/lib/unistr/u16-strchr.c
+++ b/lib/unistr/u16-strchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-16 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -32,8 +35,6 @@
uint16_t *
u16_strchr (const uint16_t *s, ucs4_t uc)
{
- uint16_t c[2];
-
if (uc < 0x10000)
{
uint16_t c0 = uc;
@@ -48,25 +49,29 @@ u16_strchr (const uint16_t *s, ucs4_t uc)
return (uint16_t *) s;
}
else
- switch (u16_uctomb_aux (c, uc, 2))
- {
- case 2:
- if (*s == 0)
- goto notfound;
+ {
+ uint16_t c[2];
+
+ switch (u16_uctomb_aux (c, uc, 2))
{
- uint16_t c0 = c[0];
- uint16_t c1 = c[1];
+ case 2:
+ if (*s == 0)
+ goto notfound;
+ {
+ uint16_t c0 = c[0];
+ uint16_t c1 = c[1];
- for (;; s++)
- {
- if (s[1] == 0)
- goto notfound;
- if (*s == c0 && s[1] == c1)
- break;
- }
- return (uint16_t *) s;
+ for (;; s++)
+ {
+ if (s[1] == 0)
+ goto notfound;
+ if (*s == c0 && s[1] == c1)
+ break;
+ }
+ return (uint16_t *) s;
+ }
}
- }
+ }
notfound:
return NULL;
}
diff --git a/lib/unistr/u16-strcmp.c b/lib/unistr/u16-strcmp.c
index 449d5d6a..96c2c1cc 100644
--- a/lib/unistr/u16-strcmp.c
+++ b/lib/unistr/u16-strcmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -38,21 +38,22 @@ u16_strcmp (const uint16_t *s1, const uint16_t *s2)
{
uint16_t c1 = *s1++;
uint16_t c2 = *s2++;
- if (c1 != 0 && c1 == c2)
- continue;
- if (c1 < 0xd800 || c1 >= 0xe000)
+ if (c1 == 0 || c1 != c2)
{
- if (!(c2 < 0xd800 || c2 >= 0xe000))
- /* c2 is a surrogate, but c1 is not. */
- return -1;
+ if (c1 < 0xd800 || c1 >= 0xe000)
+ {
+ if (!(c2 < 0xd800 || c2 >= 0xe000))
+ /* c2 is a surrogate, but c1 is not. */
+ return -1;
+ }
+ else
+ {
+ if (c2 < 0xd800 || c2 >= 0xe000)
+ /* c1 is a surrogate, but c2 is not. */
+ return 1;
+ }
+ return (int)c1 - (int)c2;
+ /* > 0 if c1 > c2, < 0 if c1 < c2. */
}
- else
- {
- if (c2 < 0xd800 || c2 >= 0xe000)
- /* c1 is a surrogate, but c2 is not. */
- return 1;
- }
- return (int)c1 - (int)c2;
- /* > 0 if c1 > c2, < 0 if c1 < c2. */
}
}
diff --git a/lib/unistr/u16-strcoll.c b/lib/unistr/u16-strcoll.c
index ea0b2d03..94a19fc1 100644
--- a/lib/unistr/u16-strcoll.c
+++ b/lib/unistr/u16-strcoll.c
@@ -1,5 +1,5 @@
/* Compare UTF-16 strings using the collation rules of the current locale.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u16-strcpy.c b/lib/unistr/u16-strcpy.c
index 798cf246..7c1a3828 100644
--- a/lib/unistr/u16-strcpy.c
+++ b/lib/unistr/u16-strcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strcspn.c b/lib/unistr/u16-strcspn.c
index c36a84c1..180de924 100644
--- a/lib/unistr/u16-strcspn.c
+++ b/lib/unistr/u16-strcspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strdup.c b/lib/unistr/u16-strdup.c
index bebed128..9dff85d7 100644
--- a/lib/unistr/u16-strdup.c
+++ b/lib/unistr/u16-strdup.c
@@ -1,5 +1,5 @@
/* Copy UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strlen.c b/lib/unistr/u16-strlen.c
index 5ef212ec..8b2b5837 100644
--- a/lib/unistr/u16-strlen.c
+++ b/lib/unistr/u16-strlen.c
@@ -1,5 +1,5 @@
/* Determine length of UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u16-strmblen.c b/lib/unistr/u16-strmblen.c
index 4cbd0204..3ca260c6 100644
--- a/lib/unistr/u16-strmblen.c
+++ b/lib/unistr/u16-strmblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u16-strmbtouc.c b/lib/unistr/u16-strmbtouc.c
index c4a9704d..8fb43df1 100644
--- a/lib/unistr/u16-strmbtouc.c
+++ b/lib/unistr/u16-strmbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-16 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u16-strncat.c b/lib/unistr/u16-strncat.c
index 4aa93252..147f8fb4 100644
--- a/lib/unistr/u16-strncat.c
+++ b/lib/unistr/u16-strncat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strncmp.c b/lib/unistr/u16-strncmp.c
index 0021dbbb..795435a5 100644
--- a/lib/unistr/u16-strncmp.c
+++ b/lib/unistr/u16-strncmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -34,29 +34,27 @@ u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n)
/* Note that the UTF-16 encoding does NOT preserve lexicographic order.
Namely, if uc1 is a 16-bit character and [uc2a,uc2b] is a surrogate pair,
we must enforce uc1 < [uc2a,uc2b], even if uc1 > uc2a. */
- for (; n > 0;)
+ for (; n > 0; n--)
{
uint16_t c1 = *s1++;
uint16_t c2 = *s2++;
- if (c1 != 0 && c1 == c2)
+ if (c1 == 0 || c1 != c2)
{
- n--;
- continue;
+ if (c1 < 0xd800 || c1 >= 0xe000)
+ {
+ if (!(c2 < 0xd800 || c2 >= 0xe000))
+ /* c2 is a surrogate, but c1 is not. */
+ return -1;
+ }
+ else
+ {
+ if (c2 < 0xd800 || c2 >= 0xe000)
+ /* c1 is a surrogate, but c2 is not. */
+ return 1;
+ }
+ return (int)c1 - (int)c2;
+ /* > 0 if c1 > c2, < 0 if c1 < c2, = 0 if c1 and c2 are both 0. */
}
- if (c1 < 0xd800 || c1 >= 0xe000)
- {
- if (!(c2 < 0xd800 || c2 >= 0xe000))
- /* c2 is a surrogate, but c1 is not. */
- return -1;
- }
- else
- {
- if (c2 < 0xd800 || c2 >= 0xe000)
- /* c1 is a surrogate, but c2 is not. */
- return 1;
- }
- return (int)c1 - (int)c2;
- /* > 0 if c1 > c2, < 0 if c1 < c2, = 0 if c1 and c2 are both 0. */
}
return 0;
}
diff --git a/lib/unistr/u16-strncpy.c b/lib/unistr/u16-strncpy.c
index 855208b0..05d3ce05 100644
--- a/lib/unistr/u16-strncpy.c
+++ b/lib/unistr/u16-strncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strnlen.c b/lib/unistr/u16-strnlen.c
index a4618a6a..a41d2968 100644
--- a/lib/unistr/u16-strnlen.c
+++ b/lib/unistr/u16-strnlen.c
@@ -1,5 +1,5 @@
/* Determine bounded length of UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strpbrk.c b/lib/unistr/u16-strpbrk.c
index 6cb82c9d..b846188b 100644
--- a/lib/unistr/u16-strpbrk.c
+++ b/lib/unistr/u16-strpbrk.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u16-strrchr.c b/lib/unistr/u16-strrchr.c
index 822a44bf..f00d0cd7 100644
--- a/lib/unistr/u16-strrchr.c
+++ b/lib/unistr/u16-strrchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-16 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -35,7 +38,6 @@ u16_strrchr (const uint16_t *s, ucs4_t uc)
/* Calling u16_strlen and then searching from the other end would cause more
memory accesses. Avoid that, at the cost of a few more comparisons. */
uint16_t *result = NULL;
- uint16_t c[2];
if (uc < 0x10000)
{
@@ -50,24 +52,28 @@ u16_strrchr (const uint16_t *s, ucs4_t uc)
}
}
else
- switch (u16_uctomb_aux (c, uc, 2))
- {
- case 2:
- if (*s)
- {
- uint16_t c0 = c[0];
- uint16_t c1 = c[1];
+ {
+ uint16_t c[2];
+
+ switch (u16_uctomb_aux (c, uc, 2))
+ {
+ case 2:
+ if (*s)
+ {
+ uint16_t c0 = c[0];
+ uint16_t c1 = c[1];
- /* FIXME: Maybe walking the string via u16_mblen is a win? */
- for (;; s++)
- {
- if (s[1] == 0)
- break;
- if (*s == c0 && s[1] == c1)
- result = (uint16_t *) s;
- }
- }
- break;
- }
+ /* FIXME: Maybe walking the string via u16_mblen is a win? */
+ for (;; s++)
+ {
+ if (s[1] == 0)
+ break;
+ if (*s == c0 && s[1] == c1)
+ result = (uint16_t *) s;
+ }
+ }
+ break;
+ }
+ }
return result;
}
diff --git a/lib/unistr/u16-strspn.c b/lib/unistr/u16-strspn.c
index dc575075..1494b570 100644
--- a/lib/unistr/u16-strspn.c
+++ b/lib/unistr/u16-strspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-strstr.c b/lib/unistr/u16-strstr.c
index 8460bb46..e2c1d480 100644
--- a/lib/unistr/u16-strstr.c
+++ b/lib/unistr/u16-strstr.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-16 strings.
- Copyright (C) 1999, 2002, 2006, 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2010-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u16-strtok.c b/lib/unistr/u16-strtok.c
index 2ee3c082..7eaed457 100644
--- a/lib/unistr/u16-strtok.c
+++ b/lib/unistr/u16-strtok.c
@@ -1,5 +1,5 @@
/* Tokenize UTF-16 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-to-u32.c b/lib/unistr/u16-to-u32.c
index 1a83b2de..d5229ca8 100644
--- a/lib/unistr/u16-to-u32.c
+++ b/lib/unistr/u16-to-u32.c
@@ -1,5 +1,5 @@
/* Convert UTF-16 string to UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -32,11 +32,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -47,18 +46,16 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- count = u16_mbtoucr (&uc, s, s_end - s);
+ ucs4_t uc;
+ int count = u16_mbtoucr (&uc, s, s_end - s);
if (count < 0)
{
if (!(result == resultbuf || result == NULL))
@@ -71,11 +68,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
/* Store it in the output string. */
if (length + 1 > allocated)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 1 > allocated)
allocated = length + 1;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -113,9 +110,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u16-to-u8.c b/lib/unistr/u16-to-u8.c
index dd434b79..1af65d65 100644
--- a/lib/unistr/u16-to-u8.c
+++ b/lib/unistr/u16-to-u8.c
@@ -1,5 +1,5 @@
/* Convert UTF-16 string to UTF-8 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -40,11 +40,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -55,18 +54,16 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- count = u16_mbtoucr (&uc, s, s_end - s);
+ ucs4_t uc;
+ int count = u16_mbtoucr (&uc, s, s_end - s);
if (count < 0)
{
if (!(result == resultbuf || result == NULL))
@@ -87,11 +84,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
}
if (count == -2)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 6 > allocated)
allocated = length + 6;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -132,9 +129,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u16-uctomb-aux.c b/lib/unistr/u16-uctomb-aux.c
index f90aad7f..a0e384e4 100644
--- a/lib/unistr/u16-uctomb-aux.c
+++ b/lib/unistr/u16-uctomb-aux.c
@@ -1,5 +1,5 @@
/* Conversion UCS-4 to UTF-16.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u16-uctomb.c b/lib/unistr/u16-uctomb.c
index 0cc6c721..9e649447 100644
--- a/lib/unistr/u16-uctomb.c
+++ b/lib/unistr/u16-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-16 string.
- Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-check.c b/lib/unistr/u32-check.c
index 813ccd55..abcc26d1 100644
--- a/lib/unistr/u32-check.c
+++ b/lib/unistr/u32-check.c
@@ -1,5 +1,5 @@
/* Check UTF-32 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-chr.c b/lib/unistr/u32-chr.c
index 65500d83..09be3107 100644
--- a/lib/unistr/u32-chr.c
+++ b/lib/unistr/u32-chr.c
@@ -1,5 +1,5 @@
/* Search character in piece of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -15,6 +15,9 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-cmp.c b/lib/unistr/u32-cmp.c
index c953c8af..dddb4bc0 100644
--- a/lib/unistr/u32-cmp.c
+++ b/lib/unistr/u32-cmp.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -31,18 +31,16 @@
int
u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n)
{
- for (; n > 0;)
+ for (; n > 0; n--)
{
uint32_t uc1 = *s1++;
uint32_t uc2 = *s2++;
- if (uc1 == uc2)
+ if (uc1 != uc2)
{
- n--;
- continue;
+ /* Note that uc1 and uc2 each have at most 31 bits. */
+ return (int)uc1 - (int)uc2;
+ /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */
}
- /* Note that uc1 and uc2 each have at most 31 bits. */
- return (int)uc1 - (int)uc2;
- /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */
}
return 0;
}
diff --git a/lib/unistr/u32-cmp2.c b/lib/unistr/u32-cmp2.c
index 6cc084f7..605d8834 100644
--- a/lib/unistr/u32-cmp2.c
+++ b/lib/unistr/u32-cmp2.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-32 strings.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u32-cpy-alloc.c b/lib/unistr/u32-cpy-alloc.c
index ecdffe52..37aa8c04 100644
--- a/lib/unistr/u32-cpy-alloc.c
+++ b/lib/unistr/u32-cpy-alloc.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-cpy.c b/lib/unistr/u32-cpy.c
index a1a840f7..fa030b66 100644
--- a/lib/unistr/u32-cpy.c
+++ b/lib/unistr/u32-cpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u32-endswith.c b/lib/unistr/u32-endswith.c
index 7b701e0b..a9b8d2a4 100644
--- a/lib/unistr/u32-endswith.c
+++ b/lib/unistr/u32-endswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-32 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-mblen.c b/lib/unistr/u32-mblen.c
index 0317b3c1..377ad60a 100644
--- a/lib/unistr/u32-mblen.c
+++ b/lib/unistr/u32-mblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-mbsnlen.c b/lib/unistr/u32-mbsnlen.c
index c2cb7277..74cc07d8 100644
--- a/lib/unistr/u32-mbsnlen.c
+++ b/lib/unistr/u32-mbsnlen.c
@@ -1,5 +1,5 @@
/* Count characters in UTF-32 string.
- Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This file is free software.
diff --git a/lib/unistr/u32-mbtouc-unsafe.c b/lib/unistr/u32-mbtouc-unsafe.c
index 0e8eecb7..f4150885 100644
--- a/lib/unistr/u32-mbtouc-unsafe.c
+++ b/lib/unistr/u32-mbtouc-unsafe.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u32-mbtouc.c b/lib/unistr/u32-mbtouc.c
index 96acabd9..ddc60783 100644
--- a/lib/unistr/u32-mbtouc.c
+++ b/lib/unistr/u32-mbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-mbtoucr.c b/lib/unistr/u32-mbtoucr.c
index 967ade81..83e34732 100644
--- a/lib/unistr/u32-mbtoucr.c
+++ b/lib/unistr/u32-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string, returning an error code.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-move.c b/lib/unistr/u32-move.c
index 3f06b30a..a07d7cd2 100644
--- a/lib/unistr/u32-move.c
+++ b/lib/unistr/u32-move.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-next.c b/lib/unistr/u32-next.c
index 8668e63b..1bcf86f4 100644
--- a/lib/unistr/u32-next.c
+++ b/lib/unistr/u32-next.c
@@ -1,5 +1,5 @@
/* Iterate over next character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -31,9 +34,7 @@
const uint32_t *
u32_next (ucs4_t *puc, const uint32_t *s)
{
- int count;
-
- count = u32_strmbtouc (puc, s);
+ int count = u32_strmbtouc (puc, s);
if (count > 0)
return s + count;
else
diff --git a/lib/unistr/u32-pcpy.c b/lib/unistr/u32-pcpy.c
index 922f704c..f05d9355 100644
--- a/lib/unistr/u32-pcpy.c
+++ b/lib/unistr/u32-pcpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-32 string, return pointer after last written unit.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2023.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u32-prev.c b/lib/unistr/u32-prev.c
index 26eb7dcd..d8369a70 100644
--- a/lib/unistr/u32-prev.c
+++ b/lib/unistr/u32-prev.c
@@ -1,5 +1,5 @@
/* Iterate over previous character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-set.c b/lib/unistr/u32-set.c
index 51cf3d63..5c1a9d5c 100644
--- a/lib/unistr/u32-set.c
+++ b/lib/unistr/u32-set.c
@@ -1,5 +1,5 @@
/* Fill UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-startswith.c b/lib/unistr/u32-startswith.c
index c9c765a7..a96a390d 100644
--- a/lib/unistr/u32-startswith.c
+++ b/lib/unistr/u32-startswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-32 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-stpcpy.c b/lib/unistr/u32-stpcpy.c
index 48cc3e14..5d4937db 100644
--- a/lib/unistr/u32-stpcpy.c
+++ b/lib/unistr/u32-stpcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-stpncpy.c b/lib/unistr/u32-stpncpy.c
index fc5177d9..6c657ae1 100644
--- a/lib/unistr/u32-stpncpy.c
+++ b/lib/unistr/u32-stpncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strcat.c b/lib/unistr/u32-strcat.c
index 2da08b18..5ef4a881 100644
--- a/lib/unistr/u32-strcat.c
+++ b/lib/unistr/u32-strcat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u32-strchr.c b/lib/unistr/u32-strchr.c
index cf8b0ca1..7e91b09b 100644
--- a/lib/unistr/u32-strchr.c
+++ b/lib/unistr/u32-strchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-strcmp.c b/lib/unistr/u32-strcmp.c
index 058cf7c4..346d46e9 100644
--- a/lib/unistr/u32-strcmp.c
+++ b/lib/unistr/u32-strcmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -35,10 +35,11 @@ u32_strcmp (const uint32_t *s1, const uint32_t *s2)
{
uint32_t uc1 = *s1++;
uint32_t uc2 = *s2++;
- if (uc1 != 0 && uc1 == uc2)
- continue;
- /* Note that uc1 and uc2 each have at most 31 bits. */
- return (int)uc1 - (int)uc2;
- /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */
+ if (uc1 == 0 || uc1 != uc2)
+ {
+ /* Note that uc1 and uc2 each have at most 31 bits. */
+ return (int)uc1 - (int)uc2;
+ /* > 0 if uc1 > uc2, < 0 if uc1 < uc2. */
+ }
}
}
diff --git a/lib/unistr/u32-strcoll.c b/lib/unistr/u32-strcoll.c
index c7de5bd6..47d5161f 100644
--- a/lib/unistr/u32-strcoll.c
+++ b/lib/unistr/u32-strcoll.c
@@ -1,5 +1,5 @@
/* Compare UTF-32 strings using the collation rules of the current locale.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u32-strcpy.c b/lib/unistr/u32-strcpy.c
index c23e8763..8a3b937b 100644
--- a/lib/unistr/u32-strcpy.c
+++ b/lib/unistr/u32-strcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strcspn.c b/lib/unistr/u32-strcspn.c
index ab6c635e..a7add17d 100644
--- a/lib/unistr/u32-strcspn.c
+++ b/lib/unistr/u32-strcspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strdup.c b/lib/unistr/u32-strdup.c
index d4e9ae56..4c5ca4f8 100644
--- a/lib/unistr/u32-strdup.c
+++ b/lib/unistr/u32-strdup.c
@@ -1,5 +1,5 @@
/* Copy UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strlen.c b/lib/unistr/u32-strlen.c
index 1c43a30a..496eb57b 100644
--- a/lib/unistr/u32-strlen.c
+++ b/lib/unistr/u32-strlen.c
@@ -1,5 +1,5 @@
/* Determine length of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u32-strmblen.c b/lib/unistr/u32-strmblen.c
index 294bcf5f..1e71279a 100644
--- a/lib/unistr/u32-strmblen.c
+++ b/lib/unistr/u32-strmblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strmbtouc.c b/lib/unistr/u32-strmbtouc.c
index 64879f2a..b02362a5 100644
--- a/lib/unistr/u32-strmbtouc.c
+++ b/lib/unistr/u32-strmbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strncat.c b/lib/unistr/u32-strncat.c
index ab16565d..c611aa0b 100644
--- a/lib/unistr/u32-strncat.c
+++ b/lib/unistr/u32-strncat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strncmp.c b/lib/unistr/u32-strncmp.c
index 0c009ada..b6d2c038 100644
--- a/lib/unistr/u32-strncmp.c
+++ b/lib/unistr/u32-strncmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -31,18 +31,16 @@
int
u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n)
{
- for (; n > 0;)
+ for (; n > 0; n--)
{
uint32_t uc1 = *s1++;
uint32_t uc2 = *s2++;
- if (uc1 != 0 && uc1 == uc2)
+ if (uc1 == 0 || uc1 != uc2)
{
- n--;
- continue;
+ /* Note that uc1 and uc2 each have at most 31 bits. */
+ return (int)uc1 - (int)uc2;
+ /* > 0 if uc1 > uc2, < 0 if uc1 < uc2, = 0 if uc1 and uc2 are both 0. */
}
- /* Note that uc1 and uc2 each have at most 31 bits. */
- return (int)uc1 - (int)uc2;
- /* > 0 if uc1 > uc2, < 0 if uc1 < uc2, = 0 if uc1 and uc2 are both 0. */
}
return 0;
}
diff --git a/lib/unistr/u32-strncpy.c b/lib/unistr/u32-strncpy.c
index 1806238e..8186c581 100644
--- a/lib/unistr/u32-strncpy.c
+++ b/lib/unistr/u32-strncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strnlen.c b/lib/unistr/u32-strnlen.c
index abdf9596..3a32c4d8 100644
--- a/lib/unistr/u32-strnlen.c
+++ b/lib/unistr/u32-strnlen.c
@@ -1,5 +1,5 @@
/* Determine bounded length of UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strpbrk.c b/lib/unistr/u32-strpbrk.c
index 8dc1543a..aa46e1aa 100644
--- a/lib/unistr/u32-strpbrk.c
+++ b/lib/unistr/u32-strpbrk.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-strrchr.c b/lib/unistr/u32-strrchr.c
index 158c954c..fa7ee149 100644
--- a/lib/unistr/u32-strrchr.c
+++ b/lib/unistr/u32-strrchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-strspn.c b/lib/unistr/u32-strspn.c
index f3625f9c..7bea5aff 100644
--- a/lib/unistr/u32-strspn.c
+++ b/lib/unistr/u32-strspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-strstr.c b/lib/unistr/u32-strstr.c
index 573c6580..be981e02 100644
--- a/lib/unistr/u32-strstr.c
+++ b/lib/unistr/u32-strstr.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-32 strings.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u32-strtok.c b/lib/unistr/u32-strtok.c
index 2723ef52..e7a23447 100644
--- a/lib/unistr/u32-strtok.c
+++ b/lib/unistr/u32-strtok.c
@@ -1,5 +1,5 @@
/* Tokenize UTF-32 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u32-to-u16.c b/lib/unistr/u32-to-u16.c
index 91dcd203..4ea9125a 100644
--- a/lib/unistr/u32-to-u16.c
+++ b/lib/unistr/u32-to-u16.c
@@ -1,5 +1,5 @@
/* Convert UTF-32 string to UTF-16 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -40,11 +40,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -55,23 +54,20 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- uc = *s++;
+ ucs4_t uc = *s++;
/* No need to call the safe variant u32_mbtouc, because
u16_uctomb will verify uc anyway. */
/* Store it in the output string. */
- count = u16_uctomb (result + length, uc, allocated - length);
+ int count = u16_uctomb (result + length, uc, allocated - length);
if (count == -1)
{
if (!(result == resultbuf || result == NULL))
@@ -81,11 +77,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
}
if (count == -2)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 2 > allocated)
allocated = length + 2;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -126,9 +122,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u32-to-u8.c b/lib/unistr/u32-to-u8.c
index e8095ce8..6460130b 100644
--- a/lib/unistr/u32-to-u8.c
+++ b/lib/unistr/u32-to-u8.c
@@ -1,5 +1,5 @@
/* Convert UTF-32 string to UTF-8 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -32,11 +32,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -47,23 +46,20 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- uc = *s++;
+ ucs4_t uc = *s++;
/* No need to call the safe variant u32_mbtouc, because
u8_uctomb will verify uc anyway. */
/* Store it in the output string. */
- count = u8_uctomb (result + length, uc, allocated - length);
+ int count = u8_uctomb (result + length, uc, allocated - length);
if (count == -1)
{
if (!(result == resultbuf || result == NULL))
@@ -73,11 +69,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
}
if (count == -2)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 6 > allocated)
allocated = length + 6;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -118,9 +114,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u32-uctomb.c b/lib/unistr/u32-uctomb.c
index 552672fa..a2d9fa76 100644
--- a/lib/unistr/u32-uctomb.c
+++ b/lib/unistr/u32-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-32 string.
- Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-check.c b/lib/unistr/u8-check.c
index 556f9927..f7fcc620 100644
--- a/lib/unistr/u8-check.c
+++ b/lib/unistr/u8-check.c
@@ -1,5 +1,5 @@
/* Check UTF-8 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -15,6 +15,9 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u8-chr.c b/lib/unistr/u8-chr.c
index 550d5756..5f98cb7f 100644
--- a/lib/unistr/u8-chr.c
+++ b/lib/unistr/u8-chr.c
@@ -1,5 +1,5 @@
/* Search character in piece of UTF-8 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -43,8 +46,7 @@ u8_chr (const uint8_t *s, size_t n, ucs4_t uc)
{
uint8_t c[6];
- size_t uc_size;
- uc_size = u8_uctomb_aux (c, uc, 6);
+ size_t uc_size = u8_uctomb_aux (c, uc, 6);
if (n < uc_size)
return NULL;
diff --git a/lib/unistr/u8-cmp.c b/lib/unistr/u8-cmp.c
index 064b8206..d00b9201 100644
--- a/lib/unistr/u8-cmp.c
+++ b/lib/unistr/u8-cmp.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-cmp2.c b/lib/unistr/u8-cmp2.c
index 11d3c364..54c9a76b 100644
--- a/lib/unistr/u8-cmp2.c
+++ b/lib/unistr/u8-cmp2.c
@@ -1,5 +1,5 @@
/* Compare pieces of UTF-8 strings.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u8-cpy-alloc.c b/lib/unistr/u8-cpy-alloc.c
index 9e3f6bff..f3caf516 100644
--- a/lib/unistr/u8-cpy-alloc.c
+++ b/lib/unistr/u8-cpy-alloc.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-cpy.c b/lib/unistr/u8-cpy.c
index e2c89c39..d5ea0412 100644
--- a/lib/unistr/u8-cpy.c
+++ b/lib/unistr/u8-cpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-endswith.c b/lib/unistr/u8-endswith.c
index f9dda573..c684262a 100644
--- a/lib/unistr/u8-endswith.c
+++ b/lib/unistr/u8-endswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-mblen.c b/lib/unistr/u8-mblen.c
index 79878f24..2d8663dd 100644
--- a/lib/unistr/u8-mblen.c
+++ b/lib/unistr/u8-mblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u8-mbsnlen.c b/lib/unistr/u8-mbsnlen.c
index 5c9bd43d..7cb168dd 100644
--- a/lib/unistr/u8-mbsnlen.c
+++ b/lib/unistr/u8-mbsnlen.c
@@ -1,5 +1,5 @@
/* Count characters in UTF-8 string.
- Copyright (C) 2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2007.
This file is free software.
@@ -31,9 +31,7 @@
size_t
u8_mbsnlen (const uint8_t *s, size_t n)
{
- size_t characters;
-
- characters = 0;
+ size_t characters = 0;
while (n > 0)
{
ucs4_t uc;
diff --git a/lib/unistr/u8-mbtouc-aux.c b/lib/unistr/u8-mbtouc-aux.c
index 22ed807b..23554b73 100644
--- a/lib/unistr/u8-mbtouc-aux.c
+++ b/lib/unistr/u8-mbtouc-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-8 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-mbtouc-unsafe-aux.c b/lib/unistr/u8-mbtouc-unsafe-aux.c
index c763bd44..eef38aa8 100644
--- a/lib/unistr/u8-mbtouc-unsafe-aux.c
+++ b/lib/unistr/u8-mbtouc-unsafe-aux.c
@@ -1,5 +1,5 @@
/* Conversion UTF-8 to UCS-4.
- Copyright (C) 2001-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2001-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-mbtouc-unsafe.c b/lib/unistr/u8-mbtouc-unsafe.c
index bfd64941..718fb20d 100644
--- a/lib/unistr/u8-mbtouc-unsafe.c
+++ b/lib/unistr/u8-mbtouc-unsafe.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-mbtouc.c b/lib/unistr/u8-mbtouc.c
index 6a863a6a..711e61d6 100644
--- a/lib/unistr/u8-mbtouc.c
+++ b/lib/unistr/u8-mbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-mbtoucr.c b/lib/unistr/u8-mbtoucr.c
index 564e47e9..fa845675 100644
--- a/lib/unistr/u8-mbtoucr.c
+++ b/lib/unistr/u8-mbtoucr.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string, returning an error code.
- Copyright (C) 1999-2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999-2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-move.c b/lib/unistr/u8-move.c
index f9f37352..00da3700 100644
--- a/lib/unistr/u8-move.c
+++ b/lib/unistr/u8-move.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-next.c b/lib/unistr/u8-next.c
index bba21662..0d4d324a 100644
--- a/lib/unistr/u8-next.c
+++ b/lib/unistr/u8-next.c
@@ -1,5 +1,5 @@
/* Iterate over next character in UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -31,9 +34,7 @@
const uint8_t *
u8_next (ucs4_t *puc, const uint8_t *s)
{
- int count;
-
- count = u8_strmbtouc (puc, s);
+ int count = u8_strmbtouc (puc, s);
if (count > 0)
return s + count;
else
diff --git a/lib/unistr/u8-pcpy.c b/lib/unistr/u8-pcpy.c
index f3caa8b7..9e7990b3 100644
--- a/lib/unistr/u8-pcpy.c
+++ b/lib/unistr/u8-pcpy.c
@@ -1,5 +1,5 @@
/* Copy piece of UTF-8 string, return pointer after last written unit.
- Copyright (C) 2020-2024 Free Software Foundation, Inc.
+ Copyright (C) 2020-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2023.
This file is free software.
diff --git a/lib/unistr/u8-prev.c b/lib/unistr/u8-prev.c
index d733f758..52ad4c7c 100644
--- a/lib/unistr/u8-prev.c
+++ b/lib/unistr/u8-prev.c
@@ -1,5 +1,5 @@
/* Iterate over previous character in UTF-8 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -15,6 +15,9 @@
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u8-set.c b/lib/unistr/u8-set.c
index b585fdbc..0d196579 100644
--- a/lib/unistr/u8-set.c
+++ b/lib/unistr/u8-set.c
@@ -1,5 +1,5 @@
/* Fill UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-startswith.c b/lib/unistr/u8-startswith.c
index 25ead39c..391b3308 100644
--- a/lib/unistr/u8-startswith.c
+++ b/lib/unistr/u8-startswith.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-stpcpy.c b/lib/unistr/u8-stpcpy.c
index 8a34960f..06fe0998 100644
--- a/lib/unistr/u8-stpcpy.c
+++ b/lib/unistr/u8-stpcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-stpncpy.c b/lib/unistr/u8-stpncpy.c
index 2c994b9e..ba17f208 100644
--- a/lib/unistr/u8-stpncpy.c
+++ b/lib/unistr/u8-stpncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strcat.c b/lib/unistr/u8-strcat.c
index 10847e61..bc6cda6f 100644
--- a/lib/unistr/u8-strcat.c
+++ b/lib/unistr/u8-strcat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strchr.c b/lib/unistr/u8-strchr.c
index 355a12c7..30468be1 100644
--- a/lib/unistr/u8-strchr.c
+++ b/lib/unistr/u8-strchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-8 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -34,8 +37,6 @@
uint8_t *
u8_strchr (const uint8_t *s, ucs4_t uc)
{
- uint8_t c[6];
-
if (uc < 0x80)
{
uint8_t c0 = uc;
@@ -62,187 +63,191 @@ u8_strchr (const uint8_t *s, ucs4_t uc)
}
}
else
+ {
/* Loops equivalent to strstr, optimized for a specific length (2, 3, 4)
of the needle. We use an algorithm similar to Boyer-Moore which
is documented in lib/unistr/u8-chr.c. There is additional
complication because we need to check after every byte for
a NUL byte, but the idea is the same. */
- switch (u8_uctomb_aux (c, uc, 6))
- {
- case 2:
- if (*s == 0 || s[1] == 0)
- break;
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
- /* Search for { c0, c1 }. */
- uint8_t s1 = s[1];
+ uint8_t c[6];
- for (;;)
- {
- /* Here s[0] != 0, s[1] != 0.
- Test whether s[0..1] == { c0, c1 }. */
- if (s1 == c1)
- {
- if (*s == c0)
- return (uint8_t *) s;
- else
- /* Skip the search at s + 1, because s[1] = c1 < c0. */
- goto case2_skip2;
- }
- else
- {
- if (s1 == c0)
- goto case2_skip1;
- else
- /* Skip the search at s + 1, because s[1] != c0. */
- goto case2_skip2;
- }
- case2_skip2:
- s++;
- s1 = s[1];
- if (s[1] == 0)
- break;
- case2_skip1:
- s++;
- s1 = s[1];
- if (s[1] == 0)
- break;
- }
- }
- break;
+ switch (u8_uctomb_aux (c, uc, 6))
+ {
+ case 2:
+ if (*s == 0 || s[1] == 0)
+ break;
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
+ /* Search for { c0, c1 }. */
+ uint8_t s1 = s[1];
- case 3:
- if (*s == 0 || s[1] == 0 || s[2] == 0)
+ for (;;)
+ {
+ /* Here s[0] != 0, s[1] != 0.
+ Test whether s[0..1] == { c0, c1 }. */
+ if (s1 == c1)
+ {
+ if (*s == c0)
+ return (uint8_t *) s;
+ else
+ /* Skip the search at s + 1, because s[1] = c1 < c0. */
+ goto case2_skip2;
+ }
+ else
+ {
+ if (s1 == c0)
+ goto case2_skip1;
+ else
+ /* Skip the search at s + 1, because s[1] != c0. */
+ goto case2_skip2;
+ }
+ case2_skip2:
+ s++;
+ s1 = s[1];
+ if (s[1] == 0)
+ break;
+ case2_skip1:
+ s++;
+ s1 = s[1];
+ if (s[1] == 0)
+ break;
+ }
+ }
break;
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
- uint8_t c2 = c[2];
- /* Search for { c0, c1, c2 }. */
- uint8_t s2 = s[2];
- for (;;)
- {
- /* Here s[0] != 0, s[1] != 0, s[2] != 0.
- Test whether s[0..2] == { c0, c1, c2 }. */
- if (s2 == c2)
- {
- if (s[1] == c1 && *s == c0)
- return (uint8_t *) s;
- else
- /* If c2 != c1:
- Skip the search at s + 1, because s[2] == c2 != c1.
- Skip the search at s + 2, because s[2] == c2 < c0. */
- if (c2 == c1)
+ case 3:
+ if (*s == 0 || s[1] == 0 || s[2] == 0)
+ break;
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
+ uint8_t c2 = c[2];
+ /* Search for { c0, c1, c2 }. */
+ uint8_t s2 = s[2];
+
+ for (;;)
+ {
+ /* Here s[0] != 0, s[1] != 0, s[2] != 0.
+ Test whether s[0..2] == { c0, c1, c2 }. */
+ if (s2 == c2)
+ {
+ if (s[1] == c1 && *s == c0)
+ return (uint8_t *) s;
+ else
+ /* If c2 != c1:
+ Skip the search at s + 1, because s[2] == c2 != c1.
+ Skip the search at s + 2, because s[2] == c2 < c0. */
+ if (c2 == c1)
+ goto case3_skip1;
+ else
+ goto case3_skip3;
+ }
+ else
+ {
+ if (s2 == c1)
goto case3_skip1;
+ else if (s2 == c0)
+ /* Skip the search at s + 1, because s[2] != c1. */
+ goto case3_skip2;
else
+ /* Skip the search at s + 1, because s[2] != c1.
+ Skip the search at s + 2, because s[2] != c0. */
goto case3_skip3;
- }
- else
- {
- if (s2 == c1)
- goto case3_skip1;
- else if (s2 == c0)
- /* Skip the search at s + 1, because s[2] != c1. */
- goto case3_skip2;
- else
- /* Skip the search at s + 1, because s[2] != c1.
- Skip the search at s + 2, because s[2] != c0. */
- goto case3_skip3;
- }
- case3_skip3:
- s++;
- s2 = s[2];
- if (s[2] == 0)
- break;
- case3_skip2:
- s++;
- s2 = s[2];
- if (s[2] == 0)
- break;
- case3_skip1:
- s++;
- s2 = s[2];
- if (s[2] == 0)
- break;
- }
- }
- break;
-
- case 4:
- if (*s == 0 || s[1] == 0 || s[2] == 0 || s[3] == 0)
+ }
+ case3_skip3:
+ s++;
+ s2 = s[2];
+ if (s[2] == 0)
+ break;
+ case3_skip2:
+ s++;
+ s2 = s[2];
+ if (s[2] == 0)
+ break;
+ case3_skip1:
+ s++;
+ s2 = s[2];
+ if (s[2] == 0)
+ break;
+ }
+ }
break;
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
- uint8_t c2 = c[2];
- uint8_t c3 = c[3];
- /* Search for { c0, c1, c2, c3 }. */
- uint8_t s3 = s[3];
- for (;;)
- {
- /* Here s[0] != 0, s[1] != 0, s[2] != 0, s[3] != 0.
- Test whether s[0..3] == { c0, c1, c2, c3 }. */
- if (s3 == c3)
- {
- if (s[2] == c2 && s[1] == c1 && *s == c0)
- return (uint8_t *) s;
- else
- /* If c3 != c2:
- Skip the search at s + 1, because s[3] == c3 != c2.
- If c3 != c1:
- Skip the search at s + 2, because s[3] == c3 != c1.
- Skip the search at s + 3, because s[3] == c3 < c0. */
- if (c3 == c2)
+ case 4:
+ if (*s == 0 || s[1] == 0 || s[2] == 0 || s[3] == 0)
+ break;
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
+ uint8_t c2 = c[2];
+ uint8_t c3 = c[3];
+ /* Search for { c0, c1, c2, c3 }. */
+ uint8_t s3 = s[3];
+
+ for (;;)
+ {
+ /* Here s[0] != 0, s[1] != 0, s[2] != 0, s[3] != 0.
+ Test whether s[0..3] == { c0, c1, c2, c3 }. */
+ if (s3 == c3)
+ {
+ if (s[2] == c2 && s[1] == c1 && *s == c0)
+ return (uint8_t *) s;
+ else
+ /* If c3 != c2:
+ Skip the search at s + 1, because s[3] == c3 != c2.
+ If c3 != c1:
+ Skip the search at s + 2, because s[3] == c3 != c1.
+ Skip the search at s + 3, because s[3] == c3 < c0. */
+ if (c3 == c2)
+ goto case4_skip1;
+ else if (c3 == c1)
+ goto case4_skip2;
+ else
+ goto case4_skip4;
+ }
+ else
+ {
+ if (s3 == c2)
goto case4_skip1;
- else if (c3 == c1)
+ else if (s3 == c1)
+ /* Skip the search at s + 1, because s[3] != c2. */
goto case4_skip2;
+ else if (s3 == c0)
+ /* Skip the search at s + 1, because s[3] != c2.
+ Skip the search at s + 2, because s[3] != c1. */
+ goto case4_skip3;
else
+ /* Skip the search at s + 1, because s[3] != c2.
+ Skip the search at s + 2, because s[3] != c1.
+ Skip the search at s + 3, because s[3] != c0. */
goto case4_skip4;
- }
- else
- {
- if (s3 == c2)
- goto case4_skip1;
- else if (s3 == c1)
- /* Skip the search at s + 1, because s[3] != c2. */
- goto case4_skip2;
- else if (s3 == c0)
- /* Skip the search at s + 1, because s[3] != c2.
- Skip the search at s + 2, because s[3] != c1. */
- goto case4_skip3;
- else
- /* Skip the search at s + 1, because s[3] != c2.
- Skip the search at s + 2, because s[3] != c1.
- Skip the search at s + 3, because s[3] != c0. */
- goto case4_skip4;
- }
- case4_skip4:
- s++;
- s3 = s[3];
- if (s[3] == 0)
- break;
- case4_skip3:
- s++;
- s3 = s[3];
- if (s[3] == 0)
- break;
- case4_skip2:
- s++;
- s3 = s[3];
- if (s[3] == 0)
- break;
- case4_skip1:
- s++;
- s3 = s[3];
- if (s[3] == 0)
- break;
- }
+ }
+ case4_skip4:
+ s++;
+ s3 = s[3];
+ if (s[3] == 0)
+ break;
+ case4_skip3:
+ s++;
+ s3 = s[3];
+ if (s[3] == 0)
+ break;
+ case4_skip2:
+ s++;
+ s3 = s[3];
+ if (s[3] == 0)
+ break;
+ case4_skip1:
+ s++;
+ s3 = s[3];
+ if (s[3] == 0)
+ break;
+ }
+ }
+ break;
}
- break;
- }
+ }
return NULL;
}
diff --git a/lib/unistr/u8-strcmp.c b/lib/unistr/u8-strcmp.c
index 385b0b53..1deb3879 100644
--- a/lib/unistr/u8-strcmp.c
+++ b/lib/unistr/u8-strcmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strcoll.c b/lib/unistr/u8-strcoll.c
index f5ff8c71..f0f5862f 100644
--- a/lib/unistr/u8-strcoll.c
+++ b/lib/unistr/u8-strcoll.c
@@ -1,5 +1,5 @@
/* Compare UTF-8 strings using the collation rules of the current locale.
- Copyright (C) 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2009.
This file is free software.
diff --git a/lib/unistr/u8-strcpy.c b/lib/unistr/u8-strcpy.c
index 60ba3384..0354d6b2 100644
--- a/lib/unistr/u8-strcpy.c
+++ b/lib/unistr/u8-strcpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strcspn.c b/lib/unistr/u8-strcspn.c
index f73621c1..ee10b336 100644
--- a/lib/unistr/u8-strcspn.c
+++ b/lib/unistr/u8-strcspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strdup.c b/lib/unistr/u8-strdup.c
index 5309690d..da4f6dbb 100644
--- a/lib/unistr/u8-strdup.c
+++ b/lib/unistr/u8-strdup.c
@@ -1,5 +1,5 @@
/* Copy UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strlen.c b/lib/unistr/u8-strlen.c
index 7f489e33..5ac6b940 100644
--- a/lib/unistr/u8-strlen.c
+++ b/lib/unistr/u8-strlen.c
@@ -1,5 +1,5 @@
/* Determine length of UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-strmblen.c b/lib/unistr/u8-strmblen.c
index 48ea2602..603b4277 100644
--- a/lib/unistr/u8-strmblen.c
+++ b/lib/unistr/u8-strmblen.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u8-strmbtouc.c b/lib/unistr/u8-strmbtouc.c
index ce6aad9e..b3bbf060 100644
--- a/lib/unistr/u8-strmbtouc.c
+++ b/lib/unistr/u8-strmbtouc.c
@@ -1,5 +1,5 @@
/* Look at first character in UTF-8 string.
- Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2024 Free Software
+ Copyright (C) 1999-2000, 2002, 2006-2007, 2009-2026 Free Software
Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
diff --git a/lib/unistr/u8-strncat.c b/lib/unistr/u8-strncat.c
index a82a7f23..7bf11e6e 100644
--- a/lib/unistr/u8-strncat.c
+++ b/lib/unistr/u8-strncat.c
@@ -1,5 +1,5 @@
/* Concatenate UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strncmp.c b/lib/unistr/u8-strncmp.c
index bc11a21d..27c03bdf 100644
--- a/lib/unistr/u8-strncmp.c
+++ b/lib/unistr/u8-strncmp.c
@@ -1,5 +1,5 @@
/* Compare UTF-8 strings.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strncpy.c b/lib/unistr/u8-strncpy.c
index 3e40f2f4..91fd0a74 100644
--- a/lib/unistr/u8-strncpy.c
+++ b/lib/unistr/u8-strncpy.c
@@ -1,5 +1,5 @@
/* Copy UTF-8 string.
- Copyright (C) 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strnlen.c b/lib/unistr/u8-strnlen.c
index 88df261f..a161add2 100644
--- a/lib/unistr/u8-strnlen.c
+++ b/lib/unistr/u8-strnlen.c
@@ -1,5 +1,5 @@
/* Determine bounded length of UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strpbrk.c b/lib/unistr/u8-strpbrk.c
index d7495649..6e19129f 100644
--- a/lib/unistr/u8-strpbrk.c
+++ b/lib/unistr/u8-strpbrk.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u8-strrchr.c b/lib/unistr/u8-strrchr.c
index 6caae2d7..c4fcee99 100644
--- a/lib/unistr/u8-strrchr.c
+++ b/lib/unistr/u8-strrchr.c
@@ -1,5 +1,5 @@
/* Search character in UTF-8 string.
- Copyright (C) 1999, 2002, 2006-2007, 2009-2024 Free Software Foundation,
+ Copyright (C) 1999, 2002, 2006-2007, 2009-2026 Free Software Foundation,
Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
@@ -24,6 +24,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
@@ -35,7 +38,6 @@ u8_strrchr (const uint8_t *s, ucs4_t uc)
/* Calling u8_strlen and then searching from the other end would cause more
memory accesses. Avoid that, at the cost of a few more comparisons. */
uint8_t *result = NULL;
- uint8_t c[6];
if (uc < 0x80)
{
@@ -50,61 +52,65 @@ u8_strrchr (const uint8_t *s, ucs4_t uc)
}
}
else
- switch (u8_uctomb_aux (c, uc, 6))
- {
- case 2:
- if (*s)
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
+ {
+ uint8_t c[6];
+
+ switch (u8_uctomb_aux (c, uc, 6))
+ {
+ case 2:
+ if (*s)
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
- /* FIXME: Maybe walking the string via u8_mblen is a win? */
- for (;; s++)
- {
- if (s[1] == 0)
- break;
- if (*s == c0 && s[1] == c1)
- result = (uint8_t *) s;
- }
- }
- break;
+ /* FIXME: Maybe walking the string via u8_mblen is a win? */
+ for (;; s++)
+ {
+ if (s[1] == 0)
+ break;
+ if (*s == c0 && s[1] == c1)
+ result = (uint8_t *) s;
+ }
+ }
+ break;
- case 3:
- if (*s && s[1])
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
- uint8_t c2 = c[2];
+ case 3:
+ if (*s && s[1])
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
+ uint8_t c2 = c[2];
- /* FIXME: Maybe walking the string via u8_mblen is a win? */
- for (;; s++)
- {
- if (s[2] == 0)
- break;
- if (*s == c0 && s[1] == c1 && s[2] == c2)
- result = (uint8_t *) s;
- }
- }
- break;
+ /* FIXME: Maybe walking the string via u8_mblen is a win? */
+ for (;; s++)
+ {
+ if (s[2] == 0)
+ break;
+ if (*s == c0 && s[1] == c1 && s[2] == c2)
+ result = (uint8_t *) s;
+ }
+ }
+ break;
- case 4:
- if (*s && s[1] && s[2])
- {
- uint8_t c0 = c[0];
- uint8_t c1 = c[1];
- uint8_t c2 = c[2];
- uint8_t c3 = c[3];
+ case 4:
+ if (*s && s[1] && s[2])
+ {
+ uint8_t c0 = c[0];
+ uint8_t c1 = c[1];
+ uint8_t c2 = c[2];
+ uint8_t c3 = c[3];
- /* FIXME: Maybe walking the string via u8_mblen is a win? */
- for (;; s++)
- {
- if (s[3] == 0)
- break;
- if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3)
- result = (uint8_t *) s;
- }
- }
- break;
- }
+ /* FIXME: Maybe walking the string via u8_mblen is a win? */
+ for (;; s++)
+ {
+ if (s[3] == 0)
+ break;
+ if (*s == c0 && s[1] == c1 && s[2] == c2 && s[3] == c3)
+ result = (uint8_t *) s;
+ }
+ }
+ break;
+ }
+ }
return result;
}
diff --git a/lib/unistr/u8-strspn.c b/lib/unistr/u8-strspn.c
index f4dd9736..c9e5cef3 100644
--- a/lib/unistr/u8-strspn.c
+++ b/lib/unistr/u8-strspn.c
@@ -1,5 +1,5 @@
/* Search for some characters in UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-strstr.c b/lib/unistr/u8-strstr.c
index df2dc964..23c64608 100644
--- a/lib/unistr/u8-strstr.c
+++ b/lib/unistr/u8-strstr.c
@@ -1,5 +1,5 @@
/* Substring test for UTF-8 strings.
- Copyright (C) 1999, 2002, 2006, 2010-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2010-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -23,6 +23,9 @@
License and of the GNU General Public License along with this
program. If not, see <https://www.gnu.org/licenses/>. */
+/* Don't use the const-improved function macros in this compilation unit. */
+#define _LIBUNISTRING_NO_CONST_GENERICS
+
#include <config.h>
/* Specification. */
diff --git a/lib/unistr/u8-strtok.c b/lib/unistr/u8-strtok.c
index 5981b747..8428b751 100644
--- a/lib/unistr/u8-strtok.c
+++ b/lib/unistr/u8-strtok.c
@@ -1,5 +1,5 @@
/* Tokenize UTF-8 string.
- Copyright (C) 1999, 2002, 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
diff --git a/lib/unistr/u8-to-u16.c b/lib/unistr/u8-to-u16.c
index 74b79741..301a0916 100644
--- a/lib/unistr/u8-to-u16.c
+++ b/lib/unistr/u8-to-u16.c
@@ -1,5 +1,5 @@
/* Convert UTF-8 string to UTF-16 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software.
@@ -40,11 +40,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -55,18 +54,16 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- count = u8_mbtoucr (&uc, s, s_end - s);
+ ucs4_t uc;
+ int count = u8_mbtoucr (&uc, s, s_end - s);
if (count < 0)
{
if (!(result == resultbuf || result == NULL))
@@ -87,11 +84,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
}
if (count == -2)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 2 > allocated)
allocated = length + 2;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -132,9 +129,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u8-to-u32.c b/lib/unistr/u8-to-u32.c
index a57bb5dc..10e6a278 100644
--- a/lib/unistr/u8-to-u32.c
+++ b/lib/unistr/u8-to-u32.c
@@ -1,5 +1,5 @@
/* Convert UTF-8 string to UTF-32 string.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
@@ -32,11 +32,10 @@ DST_UNIT *
FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
{
const SRC_UNIT *s_end = s + n;
+
/* Output string accumulator. */
DST_UNIT *result;
size_t allocated;
- size_t length;
-
if (resultbuf != NULL)
{
result = resultbuf;
@@ -47,18 +46,16 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
result = NULL;
allocated = 0;
}
- length = 0;
+ size_t length = 0;
/* Invariants:
result is either == resultbuf or == NULL or malloc-allocated.
If length > 0, then result != NULL. */
while (s < s_end)
{
- ucs4_t uc;
- int count;
-
/* Fetch a Unicode character from the input string. */
- count = u8_mbtoucr (&uc, s, s_end - s);
+ ucs4_t uc;
+ int count = u8_mbtoucr (&uc, s, s_end - s);
if (count < 0)
{
if (!(result == resultbuf || result == NULL))
@@ -71,11 +68,11 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
/* Store it in the output string. */
if (length + 1 > allocated)
{
- DST_UNIT *memory;
-
allocated = (allocated > 0 ? 2 * allocated : 12);
if (length + 1 > allocated)
allocated = length + 1;
+
+ DST_UNIT *memory;
if (result == resultbuf || result == NULL)
memory = (DST_UNIT *) malloc (allocated * sizeof (DST_UNIT));
else
@@ -113,9 +110,8 @@ FUNC (const SRC_UNIT *s, size_t n, DST_UNIT *resultbuf, size_t *lengthp)
else if (result != resultbuf && length < allocated)
{
/* Shrink the allocated memory if possible. */
- DST_UNIT *memory;
-
- memory = (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
+ DST_UNIT *memory =
+ (DST_UNIT *) realloc (result, length * sizeof (DST_UNIT));
if (memory != NULL)
result = memory;
}
diff --git a/lib/unistr/u8-uctomb-aux.c b/lib/unistr/u8-uctomb-aux.c
index ffe567d9..59d78d3f 100644
--- a/lib/unistr/u8-uctomb-aux.c
+++ b/lib/unistr/u8-uctomb-aux.c
@@ -1,5 +1,5 @@
/* Conversion UCS-4 to UTF-8.
- Copyright (C) 2002, 2006-2007, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2006-2007, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify
diff --git a/lib/unistr/u8-uctomb.c b/lib/unistr/u8-uctomb.c
index 0f903fdb..eafec47e 100644
--- a/lib/unistr/u8-uctomb.c
+++ b/lib/unistr/u8-uctomb.c
@@ -1,5 +1,5 @@
/* Store a character in UTF-8 string.
- Copyright (C) 2002, 2005-2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005-2006, 2009-2026 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2002.
This file is free software: you can redistribute it and/or modify