This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] Modify strnstr.c.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]