This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH v2] Modify strnstr.c.
- From: Craig Howland <howland at LGSInnovations dot com>
- To: <newlib at sourceware dot org>
- Date: Wed, 30 Aug 2017 10:59:03 -0400
- Subject: Re: [PATCH v2] Modify strnstr.c.
- Authentication-results: sourceware.org; auth=none
- References: <1504062237-19638-1-git-send-email-1473996754@qq.com>
On 08/29/2017 11:03 PM, Sichen Zhao wrote:
char *
-strnstr(const char *s, const char *find, size_t slen)
+strnstr(const char *haystack, const char *needle, size_t haystack_len)
This change to the function prototype makes it mismatch the preceding comment
which summarizes the function:
/*
* Find the first occurrence of find in s, where the search is limited to the
* first slen characters of s.
*/
While it obviously works either way, the former names are the more common way to
refer to these things, so while the comment can obviously be changed to match
the prototype, keeping the original names seems more appropriate.
Craig