[sr-dev] str_str function

Vicente Hernando vhernando at systemonenoc.com
Wed Jun 13 19:17:02 CEST 2012


Hello Henning,

On 06/13/2012 04:53 PM, Henning Westerholt wrote:
> Am Mittwoch, 13. Juni 2012, 15:47:59 schrieb Vicente Hernando:
>> Looking into strstr man page: char *strstr(const char *haystack, const
>> char *needle);
>>
>> the patch advantage would be it already knows string lengths and has not
>> to calculate them. Otherwise I expect strstr use a similar to Raita
>> algoritm.
> Hello Vincente,
>
> in the past I replaced some internally re-implemented string functions with
> the ones from the glibc. So in my opinion we could do the same with this
> function here, maybe add a small wrapper around it to not change the
> signature.
I see using glibc functions as a good general approach.

Only doubt is when changing str strings into zero terminated strings, 
quickest way is adding '\0' at the end.

Is it always guaranteed to have enough space at the end of str.s to 
store '\0' value?

Best regards,
Vicente.
> Regards,
>
> Henning
>




More information about the sr-dev mailing list