Re: Libification project (SoC)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <junkio@...>
Cc: Shawn O. Pearce <spearce@...>, Petr Baudis <pasky@...>, <git@...>
Date: Sunday, March 18, 2007 - 12:18 pm

On Sat, 17 Mar 2007 22:52:52 -0700
Junio C Hamano <junkio@cox.net> wrote:

| "Shawn O. Pearce" <spearce@spearce.org> 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.

 Other possibility is to let the caller do the job.

 I mean, if the information needed to print the error message (packfile
name and version in this example) is available to the caller, or the
caller can get it someway, then the caller could check which error
he got and build the message himself.

 That seems simpler to me, considering the caller has the needed
info, of course...


-- 
Luiz Fernando N. Capitulino
-
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Libification project (SoC), Luiz Fernando N. Capitulino..., (Fri Mar 16, 12:24 am)
Re: Libification project (SoC), Shawn O. Pearce, (Fri Mar 16, 12:59 am)
Re: Libification project (SoC), Petr Baudis, (Fri Mar 16, 8:55 am)
Re: Libification project (SoC), Junio C Hamano, (Fri Mar 16, 1:30 am)
Re: Libification project (SoC), Luiz Fernando N. Capitulino..., (Fri Mar 16, 9:47 am)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 11:16 am)
Re: Libification project (SoC), Petr Baudis, (Fri Mar 16, 10:08 am)
Re: Libification project (SoC), Luiz Fernando N. Capitulino..., (Fri Mar 16, 2:38 pm)
Re: Libification project (SoC), Shawn O. Pearce, (Fri Mar 16, 7:16 pm)
Re: Libification project (SoC), Luiz Fernando N. Capitulino..., (Sat Mar 17, 3:58 pm)
Re: Libification project (SoC), Shawn O. Pearce, (Sun Mar 18, 1:23 am)
Re: Libification project (SoC), Junio C Hamano, (Sun Mar 18, 1:52 am)
Re: Libification project (SoC), Luiz Fernando N. Capitulino..., (Sun Mar 18, 12:18 pm)
Re: Libification project (SoC), Nicolas Pitre, (Sun Mar 18, 5:15 pm)
Re: Libification project (SoC), Junio C Hamano, (Sun Mar 18, 3:31 pm)
Re: Libification project (SoC), Luiz Fernando N. Capitulino..., (Mon Mar 19, 12:09 pm)
Re: Libification project (SoC), Petr Baudis, (Fri Mar 16, 8:53 am)
Re: Libification project (SoC), Shawn O. Pearce, (Fri Mar 16, 2:00 am)
Re: Libification project (SoC), Junio C Hamano, (Fri Mar 16, 2:54 am)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 7:54 am)
Re: Libification project (SoC), Rocco Rutte, (Fri Mar 16, 9:09 am)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 11:12 am)
Re: Libification project (SoC), Petr Baudis, (Sun Mar 18, 10:08 am)
Re: Libification project (SoC), Johannes Schindelin, (Sun Mar 18, 7:48 pm)
Re: Libification project (SoC), Petr Baudis, (Sun Mar 18, 9:21 pm)
Re: Libification project (SoC), Johannes Schindelin, (Sun Mar 18, 9:43 pm)
Re: Libification project (SoC), Marco Costalba, (Mon Mar 19, 3:01 am)
Re: Libification project (SoC), Johannes Schindelin, (Mon Mar 19, 8:37 am)
Re: Libification project (SoC), Marco Costalba, (Mon Mar 19, 9:04 am)
Re: Libification project (SoC), Petr Baudis, (Mon Mar 19, 8:52 am)
Re: Libification project (SoC), Johannes Schindelin, (Mon Mar 19, 9:55 am)
Re: Libification project (SoC), Steve , (Mon Mar 19, 6:33 am)
Re: Libification project (SoC), Steve , (Mon Mar 19, 5:46 am)
Re: Libification project (SoC), Theodore Tso, (Sun Mar 18, 10:56 pm)
Re: Libification project (SoC), Linus Torvalds, (Mon Mar 19, 12:28 pm)
Re: Libification project (SoC), Andreas Ericsson, (Wed Mar 21, 7:17 am)
Re: Libification project (SoC), Linus Torvalds, (Wed Mar 21, 1:24 pm)
Re: Libification project (SoC), Andreas Ericsson, (Thu Mar 22, 5:51 am)
Re: Libification project (SoC), Linus Torvalds, (Mon Mar 19, 12:32 pm)
Re: Libification project (SoC), Johannes Schindelin, (Mon Mar 19, 10:57 am)
Re: Libification project (SoC), Shawn O. Pearce, (Sun Mar 18, 11:55 pm)
Re: Libification project (SoC), Marco Costalba, (Fri Mar 16, 2:20 pm)
Re: Libification project (SoC), Marco Costalba, (Fri Mar 16, 2:38 pm)
Re: Libification project (SoC), Andy Parkins, (Fri Mar 16, 3:09 pm)
Re: Libification project (SoC), Nicolas Pitre, (Fri Mar 16, 2:59 pm)
Re: Libification project (SoC), Marco Costalba, (Fri Mar 16, 5:07 pm)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 7:24 pm)
Re: Libification project (SoC), Marco Costalba, (Sat Mar 17, 3:04 am)
Re: Libification project (SoC), Johannes Schindelin, (Sat Mar 17, 1:29 pm)
Re: Libification project (SoC), Nicolas Pitre, (Fri Mar 16, 11:55 am)
Re: Libification project (SoC), Shawn O. Pearce, (Fri Mar 16, 12:17 pm)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 12:13 pm)
Re: Libification project (SoC), Nicolas Pitre, (Fri Mar 16, 12:26 pm)
Re: Libification project (SoC), Johannes Schindelin, (Fri Mar 16, 7:26 pm)
Re: Libification project (SoC), Steve , (Fri Mar 16, 2:22 pm)
Re: Libification project (SoC), Nicolas Pitre, (Fri Mar 16, 2:53 pm)
Re: Libification project (SoC), Petr Baudis, (Sun Mar 18, 9:57 am)