This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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 3/4] Use pointers for traversing arrays in strstr, strcasestr and memmem.


On 17/08/2012, at 2:51 PM, Carlos O'Donell wrote:

> On 5/30/2012 5:11 AM, Maxim Kuvyrkov wrote:
>> [PATCH 3/4] Use pointers for traversing arrays in strstr, strcasestr and memmem.
>> 
...
>> +      const unsigned char *phaystack = &haystack[suffix];
>>       /* The comparison always starts from needle[suffix], so cache it
>> 	 and use an optimized first-character loop.  */
>>       unsigned char needle_suffix = CANON_ELEMENT (needle[suffix]);
>> @@ -282,23 +290,28 @@ two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
>>       while (AVAILABLE1 (haystack, haystack_len, j, needle_len))
>> 	{
>> 	  unsigned char a;
>> +	  const unsigned char *pneedle;
> 
> (1) Use a meaningful variable name please.

Any suggestions?  I think p<foo> is a fairly standard name for a pointer to <foo>.  Do you think haystack_ptr and needle_ptr sound better?

Thanks,

--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics



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