for (cp = name + len - 1; name + 2 <= cp; cp--) {
char ch = *cp;
- if (hexval(ch) & ~0377) {
+ if (!isxdigit(ch)) {
/* We must be looking at g in "SOMETHING-g"
* for it to be describe output.
*/
int pos;
if (!only_to_die && namelen > 2 && name[1] == '/') {
struct commit_list *list = NULL;
- for_each_ref(handle_one_ref, &list);
+ struct each_ref_fn_sha1_adapter wrapped_handle_one_ref =
+ {handle_one_ref, &list};
+
+ for_each_ref(each_ref_fn_adapter, &wrapped_handle_one_ref);
commit_list_sort_by_date(&list);
return get_sha1_oneline(name + 2, sha1, list);
}
namelen = strlen(cp);
}
- strncpy(oc->path, cp,
- sizeof(oc->path));
- oc->path[sizeof(oc->path)-1] = '\0';
+ strlcpy(oc->path, cp, sizeof(oc->path));
if (!active_cache)
read_cache();
name, len);
}
hashcpy(oc->tree, tree_sha1);
- strncpy(oc->path, filename,
- sizeof(oc->path));
- oc->path[sizeof(oc->path)-1] = '\0';
+ strlcpy(oc->path, filename, sizeof(oc->path));
free(new_filename);
return ret;