Re: [PATCH 2/2] dir: remove PATH_MAX limitation

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

 



On Sat, Jul 05, 2014 at 12:42:29AM +0200, Karsten Blees wrote:

> Note: this fix just 'abuses' strbuf as string allocator, len is always 0.
> prep_exclude() can probably be simplified using more strbuf APIs.

Hrm. It looks like you grow it and add some data, but really don't want
the length to expand (because the caller depends on it).

In other directory-traversal code we follow a pattern like:

  size_t prefix_len = dir->base.len;

  strbuf_add(&dir->base, cp, stk->baselen - current);
  /* use full path in dir->base, then "pop" */
  strbuf_setlen(&dir->base, stk->baselen);

That makes it a little more obvious that the memcpy matches the
strbuf_grow (because it all happens inside strbuf_add).

Is it possible to do something like that here?

-Peff
--
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]