[CRIU] [PATCH 1/7] util: Introduce strstartswith helper

Cyrill Gorcunov gorcunov at gmail.com
Thu May 8 07:16:43 PDT 2014


On Thu, May 08, 2014 at 05:41:14PM +0400, Pavel Emelyanov wrote:
> On 05/08/2014 05:27 PM, Cyrill Gorcunov wrote:
> > On Thu, May 08, 2014 at 05:23:36PM +0400, Pavel Emelyanov wrote:
> >>>
> >>> Don't you rather compare two strings? Why not to use strcmp here?
> >>
> >> Because
> >>
> >> strcmp("foo/bar", "foo") == false
> >> strstartswith("foo/bar", "foo") == true
> >>
> >> :)
> > 
> > IOW, you're comparing prefixes. OK.
> > 
> 
> No, I'm not.
> 
> strstartswith("foo", "foo/bar") == false

Yes you're. you're looking for prefix in the string, and
I guess it would worth to name it so -- has_prefix(string,prefix).
But whatever. Thanks.


More information about the CRIU mailing list