[glib: 1/2] Improve docstrings of 'g_strstr_len' and 'g_strrstr_len' (fixes: #2223)




commit 3b10a07126816061e1e86bd78578957c304484a6
Author: Reuben Thomas <rrt sc3d org>
Date:   Thu Oct 15 00:02:25 2020 +0100

    Improve docstrings of 'g_strstr_len' and 'g_strrstr_len' (fixes: #2223)
    
    glib/gstrfuncs.c: clarify the functions’ ability to process
    non-nul-terminated strings with a negative 'haystack_length' argument.

 glib/gstrfuncs.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index 01f4fe3a8..afedf4f78 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -2689,10 +2689,9 @@ g_strjoin (const gchar *separator,
 
 /**
  * g_strstr_len:
- * @haystack: a string
- * @haystack_len: the maximum length of @haystack. Note that -1 is
- *     a valid length, if @haystack is nul-terminated, meaning it will
- *     search through the whole string.
+ * @haystack: a nul-terminated string
+ * @haystack_len: the maximum length of @haystack in bytes. A length of -1
+ *     can be used to mean "search the entire string", like `strstr()`.
  * @needle: the string to search for
  *
  * Searches the string @haystack for the first occurrence
@@ -2796,7 +2795,8 @@ g_strrstr (const gchar *haystack,
 /**
  * g_strrstr_len:
  * @haystack: a nul-terminated string
- * @haystack_len: the maximum length of @haystack
+ * @haystack_len: the maximum length of @haystack in bytes. A length of -1
+ *     can be used to mean "search the entire string", like g_strrstr().
  * @needle: the nul-terminated string to search for
  *
  * Searches the string @haystack for the last occurrence


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