+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.
}
+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)
{
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)
{
/* 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);
_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. */