Re: [PATCH 3/4] diffcore-pickaxe: further refactor count_match()

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

 



René Scharfe <rene.scharfe@xxxxxxxxxxxxxx> writes:

>> -
>> -	} else { /* Classic exact string match */
>> -		/* Yes, I've heard of strstr(), but the thing is *data may
>> -		 * not be NUL terminated.  Sue me.
>> -		 */
>> +	} else {
>> +		/* data many not be NUL terminated; we cannot use strstr() */
>
> That looks fishy to me.  regexec() expects data to be a NUL-terminated
> string, so either the comment is wrong or the regexp case needs to take
> better care to add a NUL at the end of the buffer.

Probably yes, but regexp side is not my code and I never use it, so... ;-)

> In any case, there is also memmem(), which uses the same fast algorithm
> as strstr() in recent glibc versions.  Like this?

Thanks; it would be nice to bench this change.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux