> Yes, you also check real_ref instead of checking if dwim_ref() returned 0.
There is. The man page says "Scanning stops when an input character does not match such a format character." Scanning includes not processing %n elements, either.
Regarding dwim_ref, dwim_ref says:
int dwim_ref(const char *str, int len, unsigned char *sha1, char **ref)
{
const char **p, *r;
int refs_found = 0;
*ref = NULL;
and since this "*ref" is not used anyway in the rest of the routine, I figured out that it's part of the interface to set "*ref" to NULL if no ref is found. Of course it could help (hint hint) if extern functions had a comment stating the interface.
I see however that I also have a "real_ref = NULL" that is actually pointless; I can take it away of course.
Go down this way and you will say that printf is useless too.
Paolo
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html