Thread (6 messages) flat view 6 messages, 4 authors, 2016-06-15

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

From: Jeff King <hidden>
Date: 2016-06-15 23:01:50

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help