git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] diff -c -p: do not die on submodules

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 29, 2009, 22:39 UTC
Message-ID
<alpine.DEB.1.00.0904300037300.10279@pacific.mpi-cbg.de>
In-Reply-To
<81b0412b0904291519m41035200n408b6ab409eed127@mail.gmail.com>
Hi,
On Thu, 30 Apr 2009, Alex Riesen wrote:
Show 37 quoted lines
> 2009/4/30 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
> > Hi,
> >
> > On Wed, 29 Apr 2009, Alex Riesen wrote:
> >
> >> 2009/4/29 Junio C Hamano <gitster@pobox.com>:
> >> > +
> >> > +       if (S_ISGITLINK(mode)) {
> >> > +               blob = xmalloc(100);
> >> > +               *size = snprintf(blob, 100,
> >> > +                                "Subproject commit %s\n", sha1_to_hex(sha1));
> >>
> >> snprintf returns a signed value. It also has a bad record of returning
> >> negative values for obscure reasons (on obscure platforms, admittedly).
> >>
> >> For this particular case,
> >>
> >>   strcpy(blob, "Subproject commit ");
> >>   strcat(blob, sha1_to_hex(sha1));
> >>   strcat(blob, "\n");
> >>   *size = strlen(blob); /* that's a constant */
> >>
> >> could be considered.
> >
> > Actually, we know _exactly_ the size of the thing.  It is 18+40+1.  But I
> > think that *size wants to have the size, not the length.  So add 1.
> >
> > In any case, I don't think that we have to jump through hoops here:
> > snprintf() is _most_ unlikely to return something negative here.  So I'd
> > say that readability trumps paranoia here.
> >
> 
> http://www.google.com/search?q=snprintf+negative+return+value
> 
> First link: http://bytes.com/groups/c/590845-snprintf-return-value
> 
> Look for "(Windows, mingw)"
No, I will not.

This is a _lousy_ time balance you propose: yourself saving a few minutes, everybody spending more time, trying to figure out what your point is, only so that you do not have to summarize in a concise manner why you thing that I am wrong.

I fully disagree with that, and refuse to obey your command, Dscho

Previous: Alex RiesenNext: Alex Riesen
Message 11 of 15 in “different git-merge behavior with regard to submodules in 1.6.2.4 vs. 1.6.2.1”
  1. Tim OlsenApr 28, 2009
  2. Junio C HamanoApr 28, 2009
  3. Finn Arne GangstadApr 28, 2009
  4. Clemens BuchacherApr 29, 2009
  5. Finn Arne GangstadApr 29, 2009
  6. Teach gitlinks to combine-diffJunio C Hamano, Apr 29, 2009
  7. diff -c -p: do not die on submodulesJunio C Hamano, Apr 29, 2009
  8. Alex RiesenApr 29, 2009
  9. Johannes SchindelinApr 29, 2009
  10. Alex RiesenApr 29, 2009
  11. Johannes SchindelinApr 29, 2009
  12. Alex RiesenApr 30, 2009
  13. Finn Arne GangstadApr 30, 2009
  14. Junio C HamanoApr 29, 2009
  15. Junio C HamanoApr 29, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.