"Shawn O. Pearce" <spearce@xxxxxxxxxxx> writes: > Take a look at sha1_file.c, open_packed_git_1: > > ... > if (!pack_version_ok(hdr.hdr_version)) > return error("packfile %s is version %u and not supported" > " (try upgrading GIT to a newer version)", > p->pack_name, ntohl(hdr.hdr_version)); > ... > > Here we are supplying a lot more than just a simple error code > that can be mapped to a static string. > > Of course that code is currently feeding it to the error function, > which today calls the error_routine (see usage.c). We could buffer > the strings sent to error()/warn() and let the caller obtain all > strings that occurred during the last API call. Actually, since we are talking about the error path, (1) we do not care performance of what happens there that much, but (2) we *do* care about not doing extra allocation. So it might make sense to have a preallocated "error string" buffer, sprintf the error message in there and return error codes. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html