bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: restrict - summary


From: Bruno Haible
Subject: Re: restrict - summary
Date: Sun, 23 Feb 2020 14:30:53 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; )

This patch, finally, makes use of 'restrict' also in the libunistring header
files.


2020-02-23  Bruno Haible  <address@hidden>

        uni*/base: Use 'restrict'.
        * lib/unitypes.in.h (_UC_RESTRICT): New macro, based on '_Restrict_'
        from lib/regex.h.
        * lib/unistr.in.h (u8_cpy, u16_cpy, u32_cpy, u8_strcpy, u16_strcpy,
        u32_strcpy, u8_stpcpy, u16_stpcpy, u32_stpcpy, u8_strncpy, u16_strncpy,
        u32_strncpy, u8_stpncpy, u16_stpncpy, u32_stpncpy, u8_strcat,
        u16_strcat, u32_strcat, u8_strncat, u16_strncat, u32_strncat, u8_strtok,
        u16_strtok, u32_strtok): Use '_UC_RESTRICT'.
        * lib/uninorm.in.h (u8_normalize, u16_normalize, u32_normalize): Use
        '_UC_RESTRICT'.
        * lib/uniconv.in.h (u8_conv_to_encoding, u16_conv_to_encoding,
        u32_conv_to_encoding): Use '_UC_RESTRICT'.
        * lib/unicase.in.h (u8_toupper, u16_toupper, u32_toupper, u8_tolower,
        u16_tolower, u32_tolower, u8_totitle, u16_totitle, u32_totitle,
        u8_ct_toupper, u16_ct_toupper, u32_ct_toupper, u8_ct_tolower,
        u16_ct_tolower, u32_ct_tolower, u8_ct_totitle, u16_ct_totitle,
        u32_ct_totitle, u8_casefold, u16_casefold, u32_casefold, u8_ct_casefold,
        u16_ct_casefold, u32_ct_casefold, u8_casexfrm, u16_casexfrm,
        u32_casexfrm, ulc_casexfrm): Use '_UC_RESTRICT'.
        * lib/unilbrk.in.h (u8_possible_linebreaks, u16_possible_linebreaks,
        u32_possible_linebreaks, ulc_possible_linebreaks, u8_width_linebreaks,
        u16_width_linebreaks, u32_width_linebreaks, ulc_width_linebreaks): Use
        '_UC_RESTRICT'.
        * lib/uniwbrk.in.h (ulc_wordbreaks): Use '_UC_RESTRICT'.
        * lib/unistdio.in.h (ulc_sprintf, ulc_snprintf, ulc_asnprintf,
        ulc_vsprintf, ulc_vsnprintf, ulc_vasnprintf, u8_u8_sprintf,
        u8_u8_snprintf, u8_u8_asnprintf, u8_u8_vsprintf, u8_u8_vsnprintf,
        u8_u8_vasnprintf, u16_u16_sprintf, u16_u16_snprintf, u16_u16_asnprintf,
        u16_u16_vsprintf, u16_u16_vsnprintf, u16_u16_vasnprintf,
        u32_u32_sprintf, u32_u32_snprintf, u32_u32_asnprintf, u32_u32_vsprintf,
        u32_u32_vsnprintf, u32_u32_vasnprintf): Use '_UC_RESTRICT'.

diff --git a/lib/unitypes.in.h b/lib/unitypes.in.h
index c7c268f..5fff76a 100644
--- a/lib/unitypes.in.h
+++ b/lib/unitypes.in.h
@@ -43,4 +43,17 @@ typedef uint32_t ucs4_t;
 # endif
 #endif
 
+/* Qualifier in a function declaration, that asserts that the caller must
+   pass a pointer to a different object in the specified pointer argument
+   than in the other pointer arguments.  */
+#ifndef _UC_RESTRICT
+# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
+#  define _UC_RESTRICT __restrict
+# elif 199901L <= __STDC_VERSION__ || defined restrict
+#  define _UC_RESTRICT restrict
+# else
+#  define _UC_RESTRICT
+# endif
+#endif
+
 #endif /* _UNITYPES_H */
diff --git a/lib/unicase.in.h b/lib/unicase.in.h
index 45c5f91..d74afa1 100644
--- a/lib/unicase.in.h
+++ b/lib/unicase.in.h
@@ -96,15 +96,15 @@ extern const char *
 extern uint8_t *
        u8_toupper (const uint8_t *s, size_t n, const char *iso639_language,
                    uninorm_t nf,
-                   uint8_t *resultbuf, size_t *lengthp);
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_toupper (const uint16_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint16_t *resultbuf, size_t *lengthp);
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_toupper (const uint32_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint32_t *resultbuf, size_t *lengthp);
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Return the lowercase mapping of a string.
    The nf argument identifies the normalization form to apply after the
@@ -112,15 +112,15 @@ extern uint32_t *
 extern uint8_t *
        u8_tolower (const uint8_t *s, size_t n, const char *iso639_language,
                    uninorm_t nf,
-                   uint8_t *resultbuf, size_t *lengthp);
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_tolower (const uint16_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint16_t *resultbuf, size_t *lengthp);
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_tolower (const uint32_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint32_t *resultbuf, size_t *lengthp);
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Return the titlecase mapping of a string.
    The nf argument identifies the normalization form to apply after the
@@ -128,15 +128,15 @@ extern uint32_t *
 extern uint8_t *
        u8_totitle (const uint8_t *s, size_t n, const char *iso639_language,
                    uninorm_t nf,
-                   uint8_t *resultbuf, size_t *lengthp);
+                   uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_totitle (const uint16_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint16_t *resultbuf, size_t *lengthp);
+                    uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_totitle (const uint32_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint32_t *resultbuf, size_t *lengthp);
+                    uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* The case-mapping context given by a prefix string.  */
 typedef struct casing_prefix_context
@@ -204,21 +204,21 @@ extern uint8_t *
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint8_t *resultbuf, size_t *lengthp);
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_ct_toupper (const uint16_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint16_t *resultbuf, size_t *lengthp);
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_ct_toupper (const uint32_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint32_t *resultbuf, size_t *lengthp);
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Return the lowercase mapping of a string that is surrounded by a prefix
    and a suffix.  */
@@ -228,21 +228,21 @@ extern uint8_t *
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint8_t *resultbuf, size_t *lengthp);
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_ct_tolower (const uint16_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint16_t *resultbuf, size_t *lengthp);
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_ct_tolower (const uint32_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint32_t *resultbuf, size_t *lengthp);
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Return the titlecase mapping of a string that is surrounded by a prefix
    and a suffix.  */
@@ -252,21 +252,21 @@ extern uint8_t *
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint8_t *resultbuf, size_t *lengthp);
+                      uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_ct_totitle (const uint16_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint16_t *resultbuf, size_t *lengthp);
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_ct_totitle (const uint32_t *s, size_t n,
                       casing_prefix_context_t prefix_context,
                       casing_suffix_context_t suffix_context,
                       const char *iso639_language,
                       uninorm_t nf,
-                      uint32_t *resultbuf, size_t *lengthp);
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Return the case folded string.
    Comparing uN_casefold (S1) and uN_casefold (S2) with uN_cmp2() is equivalent
@@ -276,15 +276,15 @@ extern uint32_t *
 extern uint8_t *
        u8_casefold (const uint8_t *s, size_t n, const char *iso639_language,
                     uninorm_t nf,
-                    uint8_t *resultbuf, size_t *lengthp);
+                    uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_casefold (const uint16_t *s, size_t n, const char *iso639_language,
                      uninorm_t nf,
-                     uint16_t *resultbuf, size_t *lengthp);
+                     uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_casefold (const uint32_t *s, size_t n, const char *iso639_language,
                      uninorm_t nf,
-                     uint32_t *resultbuf, size_t *lengthp);
+                     uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 /* Likewise, for a string that is surrounded by a prefix and a suffix.  */
 extern uint8_t *
        u8_ct_casefold (const uint8_t *s, size_t n,
@@ -292,21 +292,21 @@ extern uint8_t *
                        casing_suffix_context_t suffix_context,
                        const char *iso639_language,
                        uninorm_t nf,
-                       uint8_t *resultbuf, size_t *lengthp);
+                       uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_ct_casefold (const uint16_t *s, size_t n,
                         casing_prefix_context_t prefix_context,
                         casing_suffix_context_t suffix_context,
                         const char *iso639_language,
                         uninorm_t nf,
-                        uint16_t *resultbuf, size_t *lengthp);
+                        uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_ct_casefold (const uint32_t *s, size_t n,
                         casing_prefix_context_t prefix_context,
                         casing_suffix_context_t suffix_context,
                         const char *iso639_language,
                         uninorm_t nf,
-                        uint32_t *resultbuf, size_t *lengthp);
+                        uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Compare S1 and S2, ignoring differences in case and normalization.
    The nf argument identifies the normalization form to apply after the
@@ -336,16 +336,20 @@ extern int
    NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization.  
*/
 extern char *
        u8_casexfrm (const uint8_t *s, size_t n, const char *iso639_language,
-                    uninorm_t nf, char *resultbuf, size_t *lengthp);
+                    uninorm_t nf,
+                    char *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern char *
        u16_casexfrm (const uint16_t *s, size_t n, const char *iso639_language,
-                     uninorm_t nf, char *resultbuf, size_t *lengthp);
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern char *
        u32_casexfrm (const uint32_t *s, size_t n, const char *iso639_language,
-                     uninorm_t nf, char *resultbuf, size_t *lengthp);
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern char *
        ulc_casexfrm (const char *s, size_t n, const char *iso639_language,
-                     uninorm_t nf, char *resultbuf, size_t *lengthp);
+                     uninorm_t nf,
+                     char *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Compare S1 and S2, ignoring differences in case and normalization, using the
    collation rules of the current locale.
diff --git a/lib/uniconv.in.h b/lib/uniconv.in.h
index 53dc3fc..d552edb 100644
--- a/lib/uniconv.in.h
+++ b/lib/uniconv.in.h
@@ -98,19 +98,19 @@ extern char *
                             enum iconv_ilseq_handler handler,
                             const uint8_t *src, size_t srclen,
                             size_t *offsets,
-                            char *resultbuf, size_t *lengthp);
+                            char *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern char *
        u16_conv_to_encoding (const char *tocode,
                              enum iconv_ilseq_handler handler,
                              const uint16_t *src, size_t srclen,
                              size_t *offsets,
-                             char *resultbuf, size_t *lengthp);
+                             char *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern char *
        u32_conv_to_encoding (const char *tocode,
                              enum iconv_ilseq_handler handler,
                              const uint32_t *src, size_t srclen,
                              size_t *offsets,
-                             char *resultbuf, size_t *lengthp);
+                             char *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 /* Converts a NUL terminated string from a given encoding.
    The result is malloc allocated, or NULL (with errno set) in case of error.
diff --git a/lib/unilbrk.in.h b/lib/unilbrk.in.h
index 408b905..6c5ac86 100644
--- a/lib/unilbrk.in.h
+++ b/lib/unilbrk.in.h
@@ -58,16 +58,16 @@ enum
  */
 extern void
        u8_possible_linebreaks (const uint8_t *s, size_t n,
-                               const char *encoding, char *p);
+                               const char *encoding, char *_UC_RESTRICT p);
 extern void
        u16_possible_linebreaks (const uint16_t *s, size_t n,
-                                const char *encoding, char *p);
+                                const char *encoding, char *_UC_RESTRICT p);
 extern void
        u32_possible_linebreaks (const uint32_t *s, size_t n,
-                                const char *encoding, char *p);
+                                const char *encoding, char *_UC_RESTRICT p);
 extern void
        ulc_possible_linebreaks (const char *s, size_t n,
-                                const char *encoding, char *p);
+                                const char *encoding, char *_UC_RESTRICT p);
 
 /* Choose the best line breaks, assuming the uc_width function.
    The string is s[0..n-1].  The maximum number of columns per line is given
@@ -84,22 +84,22 @@ extern int
        u8_width_linebreaks (const uint8_t *s, size_t n, int width,
                             int start_column, int at_end_columns,
                             const char *o, const char *encoding,
-                            char *p);
+                            char *_UC_RESTRICT p);
 extern int
        u16_width_linebreaks (const uint16_t *s, size_t n, int width,
                              int start_column, int at_end_columns,
                              const char *o, const char *encoding,
-                             char *p);
+                             char *_UC_RESTRICT p);
 extern int
        u32_width_linebreaks (const uint32_t *s, size_t n, int width,
                              int start_column, int at_end_columns,
                              const char *o, const char *encoding,
-                             char *p);
+                             char *_UC_RESTRICT p);
 extern int
        ulc_width_linebreaks (const char *s, size_t n, int width,
                              int start_column, int at_end_columns,
                              const char *o, const char *encoding,
-                             char *p);
+                             char *_UC_RESTRICT p);
 
 
 #ifdef __cplusplus
diff --git a/lib/uninorm.in.h b/lib/uninorm.in.h
index 9ebdb6b..4cef857 100644
--- a/lib/uninorm.in.h
+++ b/lib/uninorm.in.h
@@ -143,13 +143,13 @@ extern uninorm_t
 /* Return the specified normalization form of a string.  */
 extern uint8_t *
        u8_normalize (uninorm_t nf, const uint8_t *s, size_t n,
-                     uint8_t *resultbuf, size_t *lengthp);
+                     uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint16_t *
        u16_normalize (uninorm_t nf, const uint16_t *s, size_t n,
-                      uint16_t *resultbuf, size_t *lengthp);
+                      uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 extern uint32_t *
        u32_normalize (uninorm_t nf, const uint32_t *s, size_t n,
-                      uint32_t *resultbuf, size_t *lengthp);
+                      uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp);
 
 
 /* Compare S1 and S2, ignoring differences in normalization.
diff --git a/lib/unistdio.in.h b/lib/unistdio.in.h
index e6091ec..cb17dd6 100644
--- a/lib/unistdio.in.h
+++ b/lib/unistdio.in.h
@@ -61,28 +61,28 @@ extern "C" {
 
 /* ASCII format string, result in locale dependent encoded 'char *'.  */
 extern int
-       ulc_sprintf (char *buf,
+       ulc_sprintf (char *_UC_RESTRICT buf,
                     const char *format, ...);
 extern int
-       ulc_snprintf (char *buf, size_t size,
+       ulc_snprintf (char *_UC_RESTRICT buf, size_t size,
                      const char *format, ...);
 extern int
        ulc_asprintf (char **resultp,
                      const char *format, ...);
 extern char *
-       ulc_asnprintf (char *resultbuf, size_t *lengthp,
+       ulc_asnprintf (char *_UC_RESTRICT resultbuf, size_t *lengthp,
                       const char *format, ...);
 extern int
-       ulc_vsprintf (char *buf,
+       ulc_vsprintf (char *_UC_RESTRICT buf,
                      const char *format, va_list ap);
 extern int
-       ulc_vsnprintf (char *buf, size_t size,
+       ulc_vsnprintf (char *_UC_RESTRICT buf, size_t size,
                       const char *format, va_list ap);
 extern int
        ulc_vasprintf (char **resultp,
                       const char *format, va_list ap);
 extern char *
-       ulc_vasnprintf (char *resultbuf, size_t *lengthp,
+       ulc_vasnprintf (char *_UC_RESTRICT resultbuf, size_t *lengthp,
                        const char *format, va_list ap);
 
 /* ASCII format string, result in UTF-8 format.  */
@@ -113,28 +113,28 @@ extern uint8_t *
 
 /* UTF-8 format string, result in UTF-8 format.  */
 extern int
-       u8_u8_sprintf (uint8_t *buf,
+       u8_u8_sprintf (uint8_t *_UC_RESTRICT buf,
                       const uint8_t *format, ...);
 extern int
-       u8_u8_snprintf (uint8_t *buf, size_t size,
+       u8_u8_snprintf (uint8_t *_UC_RESTRICT buf, size_t size,
                        const uint8_t *format, ...);
 extern int
        u8_u8_asprintf (uint8_t **resultp,
                        const uint8_t *format, ...);
 extern uint8_t *
-       u8_u8_asnprintf (uint8_t *resultbuf, size_t *lengthp,
+       u8_u8_asnprintf (uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                         const uint8_t *format, ...);
 extern int
-       u8_u8_vsprintf (uint8_t *buf,
+       u8_u8_vsprintf (uint8_t *_UC_RESTRICT buf,
                        const uint8_t *format, va_list ap);
 extern int
-       u8_u8_vsnprintf (uint8_t *buf, size_t size,
+       u8_u8_vsnprintf (uint8_t *_UC_RESTRICT buf, size_t size,
                         const uint8_t *format, va_list ap);
 extern int
        u8_u8_vasprintf (uint8_t **resultp,
                         const uint8_t *format, va_list ap);
 extern uint8_t *
-       u8_u8_vasnprintf (uint8_t *resultbuf, size_t *lengthp,
+       u8_u8_vasnprintf (uint8_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                          const uint8_t *format, va_list ap);
 
 /* ASCII format string, result in UTF-16 format.  */
@@ -165,28 +165,28 @@ extern uint16_t *
 
 /* UTF-16 format string, result in UTF-16 format.  */
 extern int
-       u16_u16_sprintf (uint16_t *buf,
+       u16_u16_sprintf (uint16_t *_UC_RESTRICT buf,
                         const uint16_t *format, ...);
 extern int
-       u16_u16_snprintf (uint16_t *buf, size_t size,
+       u16_u16_snprintf (uint16_t *_UC_RESTRICT buf, size_t size,
                          const uint16_t *format, ...);
 extern int
        u16_u16_asprintf (uint16_t **resultp,
                          const uint16_t *format, ...);
 extern uint16_t *
-       u16_u16_asnprintf (uint16_t *resultbuf, size_t *lengthp,
+       u16_u16_asnprintf (uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                           const uint16_t *format, ...);
 extern int
-       u16_u16_vsprintf (uint16_t *buf,
+       u16_u16_vsprintf (uint16_t *_UC_RESTRICT buf,
                          const uint16_t *format, va_list ap);
 extern int
-       u16_u16_vsnprintf (uint16_t *buf, size_t size,
+       u16_u16_vsnprintf (uint16_t *_UC_RESTRICT buf, size_t size,
                           const uint16_t *format, va_list ap);
 extern int
        u16_u16_vasprintf (uint16_t **resultp,
                           const uint16_t *format, va_list ap);
 extern uint16_t *
-       u16_u16_vasnprintf (uint16_t *resultbuf, size_t *lengthp,
+       u16_u16_vasnprintf (uint16_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                            const uint16_t *format, va_list ap);
 
 /* ASCII format string, result in UTF-32 format.  */
@@ -217,28 +217,28 @@ extern uint32_t *
 
 /* UTF-32 format string, result in UTF-32 format.  */
 extern int
-       u32_u32_sprintf (uint32_t *buf,
+       u32_u32_sprintf (uint32_t *_UC_RESTRICT buf,
                         const uint32_t *format, ...);
 extern int
-       u32_u32_snprintf (uint32_t *buf, size_t size,
+       u32_u32_snprintf (uint32_t *_UC_RESTRICT buf, size_t size,
                          const uint32_t *format, ...);
 extern int
        u32_u32_asprintf (uint32_t **resultp,
                          const uint32_t *format, ...);
 extern uint32_t *
-       u32_u32_asnprintf (uint32_t *resultbuf, size_t *lengthp,
+       u32_u32_asnprintf (uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                           const uint32_t *format, ...);
 extern int
-       u32_u32_vsprintf (uint32_t *buf,
+       u32_u32_vsprintf (uint32_t *_UC_RESTRICT buf,
                          const uint32_t *format, va_list ap);
 extern int
-       u32_u32_vsnprintf (uint32_t *buf, size_t size,
+       u32_u32_vsnprintf (uint32_t *_UC_RESTRICT buf, size_t size,
                           const uint32_t *format, va_list ap);
 extern int
        u32_u32_vasprintf (uint32_t **resultp,
                           const uint32_t *format, va_list ap);
 extern uint32_t *
-       u32_u32_vasnprintf (uint32_t *resultbuf, size_t *lengthp,
+       u32_u32_vasnprintf (uint32_t *_UC_RESTRICT resultbuf, size_t *lengthp,
                            const uint32_t *format, va_list ap);
 
 /* ASCII format string, output to FILE in locale dependent encoding.  */
diff --git a/lib/unistr.in.h b/lib/unistr.in.h
index bc0d237..0acfae6 100644
--- a/lib/unistr.in.h
+++ b/lib/unistr.in.h
@@ -373,11 +373,11 @@ u32_uctomb (uint32_t *s, ucs4_t uc, int n)
 /* Copy N units from SRC to DEST.  */
 /* Similar to memcpy().  */
 extern uint8_t *
-       u8_cpy (uint8_t *dest, const uint8_t *src, size_t n);
+       u8_cpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
 extern uint16_t *
-       u16_cpy (uint16_t *dest, const uint16_t *src, size_t n);
+       u16_cpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t n);
 extern uint32_t *
-       u32_cpy (uint32_t *dest, const uint32_t *src, size_t n);
+       u32_cpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t n);
 
 /* Copy N units from SRC to DEST, guaranteeing correct behavior for
    overlapping memory areas.  */
@@ -528,57 +528,57 @@ extern size_t
 /* Copy SRC to DEST.  */
 /* Similar to strcpy(), wcscpy().  */
 extern uint8_t *
-       u8_strcpy (uint8_t *dest, const uint8_t *src);
+       u8_strcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
 extern uint16_t *
-       u16_strcpy (uint16_t *dest, const uint16_t *src);
+       u16_strcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
 extern uint32_t *
-       u32_strcpy (uint32_t *dest, const uint32_t *src);
+       u32_strcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
 
 /* Copy SRC to DEST, returning the address of the terminating NUL in DEST.  */
 /* Similar to stpcpy().  */
 extern uint8_t *
-       u8_stpcpy (uint8_t *dest, const uint8_t *src);
+       u8_stpcpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
 extern uint16_t *
-       u16_stpcpy (uint16_t *dest, const uint16_t *src);
+       u16_stpcpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
 extern uint32_t *
-       u32_stpcpy (uint32_t *dest, const uint32_t *src);
+       u32_stpcpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
 
 /* Copy no more than N units of SRC to DEST.  */
 /* Similar to strncpy(), wcsncpy().  */
 extern uint8_t *
-       u8_strncpy (uint8_t *dest, const uint8_t *src, size_t n);
+       u8_strncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
 extern uint16_t *
-       u16_strncpy (uint16_t *dest, const uint16_t *src, size_t n);
+       u16_strncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t 
n);
 extern uint32_t *
-       u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n);
+       u32_strncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t 
n);
 
 /* Copy no more than N units of SRC to DEST.  Return a pointer past the last
    non-NUL unit written into DEST.  */
 /* Similar to stpncpy().  */
 extern uint8_t *
-       u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n);
+       u8_stpncpy (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
 extern uint16_t *
-       u16_stpncpy (uint16_t *dest, const uint16_t *src, size_t n);
+       u16_stpncpy (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t 
n);
 extern uint32_t *
-       u32_stpncpy (uint32_t *dest, const uint32_t *src, size_t n);
+       u32_stpncpy (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t 
n);
 
 /* Append SRC onto DEST.  */
 /* Similar to strcat(), wcscat().  */
 extern uint8_t *
-       u8_strcat (uint8_t *dest, const uint8_t *src);
+       u8_strcat (uint8_t *_UC_RESTRICT dest, const uint8_t *src);
 extern uint16_t *
-       u16_strcat (uint16_t *dest, const uint16_t *src);
+       u16_strcat (uint16_t *_UC_RESTRICT dest, const uint16_t *src);
 extern uint32_t *
-       u32_strcat (uint32_t *dest, const uint32_t *src);
+       u32_strcat (uint32_t *_UC_RESTRICT dest, const uint32_t *src);
 
 /* Append no more than N units of SRC onto DEST.  */
 /* Similar to strncat(), wcsncat().  */
 extern uint8_t *
-       u8_strncat (uint8_t *dest, const uint8_t *src, size_t n);
+       u8_strncat (uint8_t *_UC_RESTRICT dest, const uint8_t *src, size_t n);
 extern uint16_t *
-       u16_strncat (uint16_t *dest, const uint16_t *src, size_t n);
+       u16_strncat (uint16_t *_UC_RESTRICT dest, const uint16_t *src, size_t 
n);
 extern uint32_t *
-       u32_strncat (uint32_t *dest, const uint32_t *src, size_t n);
+       u32_strncat (uint32_t *_UC_RESTRICT dest, const uint32_t *src, size_t 
n);
 
 /* Compare S1 and S2.  */
 /* Similar to strcmp(), wcscmp().  */
@@ -732,11 +732,14 @@ extern bool
    This interface is actually more similar to wcstok than to strtok.  */
 /* Similar to strtok_r(), wcstok().  */
 extern uint8_t *
-       u8_strtok (uint8_t *str, const uint8_t *delim, uint8_t **ptr);
+       u8_strtok (uint8_t *_UC_RESTRICT str, const uint8_t *delim,
+                  uint8_t **ptr);
 extern uint16_t *
-       u16_strtok (uint16_t *str, const uint16_t *delim, uint16_t **ptr);
+       u16_strtok (uint16_t *_UC_RESTRICT str, const uint16_t *delim,
+                   uint16_t **ptr);
 extern uint32_t *
-       u32_strtok (uint32_t *str, const uint32_t *delim, uint32_t **ptr);
+       u32_strtok (uint32_t *_UC_RESTRICT str, const uint32_t *delim,
+                   uint32_t **ptr);
 
 
 #ifdef __cplusplus
diff --git a/lib/uniwbrk.in.h b/lib/uniwbrk.in.h
index 1407644..136aad0 100644
--- a/lib/uniwbrk.in.h
+++ b/lib/uniwbrk.in.h
@@ -81,7 +81,7 @@ extern void
 extern void
        u32_wordbreaks (const uint32_t *s, size_t n, char *p);
 extern void
-       ulc_wordbreaks (const char *s, size_t n, char *p);
+       ulc_wordbreaks (const char *s, size_t n, char *_UC_RESTRICT p);
 
 /* ========================================================================= */
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]