]> Savannah Git Hosting - gnulib.git/commitdiff
string-desc: Fix categorization string_desc_new_addr.
authorBruno Haible <bruno@clisp.org>
Sun, 13 Oct 2024 09:35:12 +0000 (11:35 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 13 Oct 2024 09:35:12 +0000 (11:35 +0200)
* lib/string-desc.h (string_desc_new_addr): Move to section
"Side-effect-free operations".
* lib/string-desc.c (string_desc_new_addr): Move accordingly.

ChangeLog
lib/string-desc.c
lib/string-desc.h

index ce225aa68e91680701d8e0736631b9311a294cec..d8aeaa5f51dd1d8bbc4ecca49ec91e25f7d38ef2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-10-13  Bruno Haible  <bruno@clisp.org>
+
+       string-desc: Fix categorization string_desc_new_addr.
+       * lib/string-desc.h (string_desc_new_addr): Move to section
+       "Side-effect-free operations".
+       * lib/string-desc.c (string_desc_new_addr): Move accordingly.
+
 2024-10-12  Bruno Haible  <bruno@clisp.org>
 
        doc: Recommend string descriptors for application area like parsers.
index 17856d95549db288592a3a954ca0d055ba70da78..58a87e12205a8892569e012be58cae651c46150a 100644 (file)
@@ -119,6 +119,20 @@ string_desc_new_empty (void)
 
 }
 
+string_desc_t
+string_desc_new_addr (idx_t n, char *addr)
+{
+  string_desc_t result;
+
+  result._nbytes = n;
+  if (n == 0)
+    result._data = NULL;
+  else
+    result._data = addr;
+
+  return result;
+}
+
 string_desc_t
 string_desc_from_c (const char *s)
 {
@@ -191,20 +205,6 @@ string_desc_new (string_desc_t *resultp, idx_t n)
   return 0;
 }
 
-string_desc_t
-string_desc_new_addr (idx_t n, char *addr)
-{
-  string_desc_t result;
-
-  result._nbytes = n;
-  if (n == 0)
-    result._data = NULL;
-  else
-    result._data = addr;
-
-  return result;
-}
-
 int
 string_desc_new_filled (string_desc_t *resultp, idx_t n, char c)
 {
index e5c969ca83c1acf11095d637a2304e7a59ca97e5..ff9c86d6a0c29a36a497437598cee184e3f88858 100644 (file)
@@ -117,6 +117,9 @@ extern ptrdiff_t string_desc_contains (string_desc_t haystack, string_desc_t nee
 /* Return an empty string.  */
 extern string_desc_t string_desc_new_empty (void);
 
+/* Construct and return a string of length N, at the given memory address.  */
+extern string_desc_t string_desc_new_addr (idx_t n, char *addr);
+
 /* Return a string that represents the C string S, of length strlen (S).  */
 extern string_desc_t string_desc_from_c (const char *s);
 
@@ -146,9 +149,6 @@ extern int string_desc_fwrite (FILE *fp, string_desc_t s);
 _GL_ATTRIBUTE_NODISCARD
 extern int string_desc_new (string_desc_t *resultp, idx_t n);
 
-/* Construct and return a string of length N, at the given memory address.  */
-extern string_desc_t string_desc_new_addr (idx_t n, char *addr);
-
 /* Construct a string of length N, filled with C.
    Return 0 if successful.
    Upon error, return -1 with errno set.  */