From: Johannes Sixt Date: Tue, 16 Feb 2010 19:47:49 GMT Subject: Re: [PATCH v3 3/5] Move offset_1st_component() to path.c Message-ID: <4B7AF665.5030207@kdbg.org> In-Reply-To: <20100216052208.GA18438@do> Nguyễn Thái Ngọc Duy schrieb: > > is_dir_sep() or even use your previous implementation of is_root_path > > (because this implementation is a bit cryptic). > > > > But if the new callers of this function will only pass the results of > > normalize_path_copy() and getcwd() (both return only forward-slashes on > > Windows), then I'm fine with this version. Do they? > > They do. But future-proofing can never be a bad thing. Thanks, but... > +int offset_1st_component(const char *path) > +{ > + int len = 0; > + if (has_dos_drive_prefix(path)) > + len += 2; > + if (is_dir_sep(path[len])) > + return len++; oops, does this work at all for you? You must not have 'return' here. > + return len; > +} -- Hannes