The loop's there anyway; we might as well use it.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
struct strbuf *sb_path,
struct strbuf *sb_contents)
{
- int depth = MAXDEPTH;
int bad_name = 0;
+ int symref_count;
if (flags)
*flags = 0;
*/
bad_name = 1;
}
- for (;;) {
+
+ for (symref_count = 0; symref_count < MAXDEPTH; symref_count++) {
const char *path;
struct stat st;
char *buf;
int fd;
- if (--depth < 0) {
- errno = ELOOP;
- return NULL;
- }
-
strbuf_reset(sb_path);
strbuf_git_path(sb_path, "%s", refname);
path = sb_path->buf;
bad_name = 1;
}
}
+
+ errno = ELOOP;
+ return NULL;
}
const char *resolve_ref_unsafe(const char *refname, int resolve_flags,