git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: "Torsten Bögershausen" <tboegi@web.de>,
	"SZEDER Gábor" <szeder.dev@gmail.com>,
	git@vger.kernel.org, "Martin Koegler" <martin.koegler@chello.at>,
	"Junio C Hamano" <gitster@pobox.com>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH v2 1/1] zlib.c: use size_t for size
Date: Sun, 14 Oct 2018 20:01:47 -0400	[thread overview]
Message-ID: <20181015000147.GB13510@sigill.intra.peff.net> (raw)
In-Reply-To: <1e3233f4-ea40-6fff-0951-6b4885f88445@ramsayjones.plus.com>

On Sun, Oct 14, 2018 at 04:03:48PM +0100, Ramsay Jones wrote:

> > So I kind of wonder if a comment would be better than xsize_t here.
> > Something like:
> > 
> >   if (avail > len) {
> > 	/*
> > 	 * This can never truncate because we know that len is smaller
> > 	 * than avail, which is already a size_t.
> > 	 */
> > 	avail = (size_t)len;
> >   }
> 
> Heh, you are, of course, correct! (that will learn me[1]). :-D
> 
> Hmm, let's see if I can muster the enthusiasm to do all that
> testing again!

For the record, I am not opposed to including the comment _and_ using
xsize_t() to do the cast, giving us an assertion that the comment is
correct.

-Peff

  reply	other threads:[~2018-10-15  0:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12  7:07 [PATCH] zlib.c: use size_t for size Junio C Hamano
2018-10-12  9:54 ` Johannes Schindelin
2018-10-12 13:52   ` Junio C Hamano
2018-10-12 15:34     ` Johannes Schindelin
2018-10-12 23:23       ` Ramsay Jones
2018-10-12 20:42 ` [PATCH v2 1/1] " tboegi
2018-10-12 22:22   ` SZEDER Gábor
2018-10-13  5:00     ` Torsten Bögershausen
2018-10-14  2:16       ` Ramsay Jones
2018-10-14  2:31         ` Ramsay Jones
2018-10-14  2:52         ` Jeff King
2018-10-14 15:03           ` Ramsay Jones
2018-10-15  0:01             ` Jeff King [this message]
2018-10-15  0:41               ` Ramsay Jones
2018-10-15  4:22                 ` Junio C Hamano
2018-10-15  5:54                   ` Torsten Bögershausen
2018-10-13  2:38 ` [PATCH] " Jeff King
2018-10-13  2:46   ` Jeff King
2018-10-13  8:43     ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181015000147.GB13510@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.koegler@chello.at \
    --cc=ramsay@ramsayjones.plus.com \
    --cc=szeder.dev@gmail.com \
    --cc=tboegi@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).