void setup_traverse_info(struct traverse_info *info, const char *base)
{
- int pathlen = strlen(base);
+ size_t pathlen = strlen(base);
static struct traverse_info dummy;
memset(info, 0, sizeof(*info));
char *make_traverse_path(char *path, const struct traverse_info *info,
const char *name, size_t namelen)
{
- int pathlen = info->pathlen;
+ size_t pathlen = info->pathlen;
path[pathlen + namelen] = 0;
for (;;) {
size_t namelen;
unsigned mode;
- int pathlen;
+ size_t pathlen;
struct pathspec *pathspec;
unsigned long df_conflicts;
const char *name, size_t namelen);
void setup_traverse_info(struct traverse_info *info, const char *base);
-static inline int traverse_path_len(const struct traverse_info *info, const struct name_entry *n)
+static inline size_t traverse_path_len(const struct traverse_info *info, const struct name_entry *n)
{
- return info->pathlen + tree_entry_len(n);
+ return st_add(info->pathlen, tree_entry_len(n));
}
/* in general, positive means "kind of interesting" */
struct traverse_info *info)
{
struct unpack_trees_options *o = info->data;
- int len = traverse_path_len(info, names);
+ size_t len = traverse_path_len(info, names);
char *name = xmalloc(len + 1 /* slash */ + 1 /* NUL */);
int pos;
newinfo.name = p->path;
newinfo.namelen = p->pathlen;
newinfo.mode = p->mode;
- newinfo.pathlen += tree_entry_len(p) + 1;
+ newinfo.pathlen = st_add3(newinfo.pathlen, tree_entry_len(p), 1);
newinfo.df_conflicts |= df_conflicts;
/*
struct index_state *istate,
int is_transient)
{
- int len = traverse_path_len(info, n);
+ size_t len = traverse_path_len(info, n);
struct cache_entry *ce =
is_transient ?
make_empty_transient_cache_entry(len) :