Johannes Sixt <j6t@xxxxxxxx> writes: > Why not just sidestep the problematic case: > > diff --git a/reftable/refname.c b/reftable/refname.c > index 9573496932..4f89956187 100644 > --- a/reftable/refname.c > +++ b/reftable/refname.c > @@ -120,17 +120,17 @@ static int modification_has_ref_with_prefix(struct modification *mod, > static int validate_refname(const char *name) > { > while (1) { > char *next = strchr(name, '/'); > if (!*name) { > return REFTABLE_REFNAME_ERROR; > } > if (!next) { > - return 0; > + break; > } > if (next - name == 0 || (next - name == 1 && *name == '.') || > (next - name == 2 && name[0] == '.' && name[1] == '.')) > return REFTABLE_REFNAME_ERROR; > name = next + 1; > } > return 0; > } > > Sure, there are returns in the loop, but they are clearly error cases. > The regular exit is now at the end of the function. ;-)