From: "Carlos L." <00xc@protonmail.com>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: "Carlos L. via GitGitGadget" <gitgitgadget@gmail.com>,
"Martin Ågren [ ]" <martin.agren@gmail.com>,
git@vger.kernel.org
Subject: Re: [PATCH] grep: add --max-count command line option
Date: Mon, 20 Jun 2022 16:25:21 +0000 [thread overview]
Message-ID: <xy0kCdbtIjKb_GkXpHs7eeE8eWLbbct69_tVczBGS3CMnnnKTlTheaeNlH-RB1mMAfWThSTN6bMThsQ4lLtr0Ji6RwG3Nd52L1muiEqdtCU=@protonmail.com> (raw)
In-Reply-To: <449bede6-82b0-72ef-300d-bc0c49a1858b@cs.ucla.edu>
Hi,
On Monday, June 20th, 2022 at 17:57, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 6/20/22 10:49, Carlos L. via GitGitGadget wrote:
>
> > + unsigned max_count;
>
>
> Why not make this intmax_t? That way, you don't have to worry about
> casting -1 to unsigned. Also on typical 64-bit machines you no longer
> have to worry about mishandling counts greater than 232 (the limit
> becomes 263 - 1 which is plenty).
This does not work well with OPTION_INTEGER, since it assumes the value to be int-sized:
parse-options.c:
219 *(int *)opt->value = strtol(arg, (char **)&s, 10);
I also wanted to avoid using signed int so both sides of the comparison with `count` in grep_source_1() have the same sign.
next prev parent reply other threads:[~2022-06-20 16:27 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-20 15:49 [PATCH] grep: add --max-count command line option Carlos L. via GitGitGadget
2022-06-20 15:57 ` Paul Eggert
2022-06-20 16:25 ` Carlos L. [this message]
2022-06-20 16:32 ` Paul Eggert
2022-06-21 5:36 ` [PATCH v2] " Carlos L. via GitGitGadget
2022-06-21 16:27 ` Junio C Hamano
2022-06-22 6:41 ` Carlos L.
2022-06-22 6:56 ` Junio C Hamano
[not found] ` <220622.86mte5knbe.gmgdl@evledraar.gmail.com>
2022-06-22 13:23 ` Carlos L.
2022-06-22 17:07 ` [PATCH v3 0/2] " Carlos L. via GitGitGadget
2022-06-22 17:07 ` [PATCH v3 1/2] " Carlos López via GitGitGadget
2022-06-22 17:07 ` [PATCH v3 2/2] tests: add tests for grep --max-count Carlos López via GitGitGadget
2022-06-22 18:10 ` Junio C Hamano
2022-06-22 19:47 ` [PATCH v4] grep: add --max-count command line option Carlos L. via GitGitGadget
-- strict thread matches above, loose matches on Subject: below --
2022-05-12 13:20 [PATCH] " Carlos L. via GitGitGadget
2022-05-14 18:16 ` Martin Ågren
2022-05-16 5:57 ` Junio C Hamano
2022-05-16 7:28 ` Paul Eggert
2022-05-16 8:38 ` Carlos L.
2022-05-16 15:36 ` Junio C Hamano
2022-05-17 5:53 ` Paul Eggert
2022-05-16 15:18 ` Junio C Hamano
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='xy0kCdbtIjKb_GkXpHs7eeE8eWLbbct69_tVczBGS3CMnnnKTlTheaeNlH-RB1mMAfWThSTN6bMThsQ4lLtr0Ji6RwG3Nd52L1muiEqdtCU=@protonmail.com' \
--to=00xc@protonmail.com \
--cc=eggert@cs.ucla.edu \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=martin.agren@gmail.com \
/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).