MCPcopy Create free account
hub / github.com/git/git / make_traverse_path

Function make_traverse_path

tree-walk.c:212–240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210}
211
212char *make_traverse_path(char *path, size_t pathlen,
213 const struct traverse_info *info,
214 const char *name, size_t namelen)
215{
216 /* Always points to the end of the name we're about to add */
217 size_t pos = st_add(info->pathlen, namelen);
218
219 if (pos >= pathlen)
220 BUG("too small buffer passed to make_traverse_path");
221
222 path[pos] = 0;
223 for (;;) {
224 if (pos < namelen)
225 BUG("traverse_info pathlen does not match strings");
226 pos -= namelen;
227 memcpy(path + pos, name, namelen);
228
229 if (!pos)
230 break;
231 path[--pos] = '/';
232
233 if (!info)
234 BUG("traverse_info ran out of list items");
235 name = info->name;
236 namelen = info->namelen;
237 info = info->prev;
238 }
239 return path;
240}
241
242void strbuf_make_traverse_path(struct strbuf *out,
243 const struct traverse_info *info,

Callers 3

create_ce_entryFunction · 0.85

Calls 1

st_addFunction · 0.85

Tested by

no test coverage detected