summaryrefslogtreecommitdiff
path: root/lib/string.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-24 08:39:55 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-24 08:39:55 +0100
commitba08cf452f3493e96793c9fec4ebb45e7101a0c0 (patch)
tree61200038de5d9c6ba50dadfa7f065d029fa06174 /lib/string.c
parente24cd4e6d6aa3ca741cdfdfc01118c4016acebea (diff)
parentf8788d86ab28f61f7b46eb6be375f8a726783636 (diff)
downloadlwn-ba08cf452f3493e96793c9fec4ebb45e7101a0c0.tar.gz
lwn-ba08cf452f3493e96793c9fec4ebb45e7101a0c0.zip
Merge 5.6-rc3 into tty-next
We want the tty fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib/string.c')
-rw-r--r--lib/string.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/string.c b/lib/string.c
index f607b967d978..6012c385fb31 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -699,6 +699,14 @@ EXPORT_SYMBOL(sysfs_streq);
* @n: number of strings in the array or -1 for NULL terminated arrays
* @string: string to match with
*
+ * This routine will look for a string in an array of strings up to the
+ * n-th element in the array or until the first NULL element.
+ *
+ * Historically the value of -1 for @n, was used to search in arrays that
+ * are NULL terminated. However, the function does not make a distinction
+ * when finishing the search: either @n elements have been compared OR
+ * the first NULL element was found.
+ *
* Return:
* index of a @string in the @array if matches, or %-EINVAL otherwise.
*/
@@ -727,6 +735,14 @@ EXPORT_SYMBOL(match_string);
*
* Returns index of @str in the @array or -EINVAL, just like match_string().
* Uses sysfs_streq instead of strcmp for matching.
+ *
+ * This routine will look for a string in an array of strings up to the
+ * n-th element in the array or until the first NULL element.
+ *
+ * Historically the value of -1 for @n, was used to search in arrays that
+ * are NULL terminated. However, the function does not make a distinction
+ * when finishing the search: either @n elements have been compared OR
+ * the first NULL element was found.
*/
int __sysfs_match_string(const char * const *array, size_t n, const char *str)
{