mbox series

[v5,0/3] parse: replace atoi() with strtoul_ui() and strtol_i()

Message ID pull.1810.v5.git.git.1729669220.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series parse: replace atoi() with strtoul_ui() and strtol_i() | expand

Message

Usman Akinyemi via GitGitGadget Oct. 23, 2024, 7:40 a.m. UTC
Changes from Version 4:

 * Fix incorrect indentation and remove unnecessary braces to avoid
   confusion.

Usman Akinyemi (3):
  daemon: replace atoi() with strtoul_ui() and strtol_i()
  merge: replace atoi() with strtol_i() for marker size validation
  imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT
    parsing

 daemon.c              | 12 ++++++++----
 imap-send.c           | 13 ++++++++-----
 merge-ll.c            | 11 +++++++++--
 t/t5570-git-daemon.sh | 26 ++++++++++++++++++++++++++
 t/t6406-merge-attr.sh |  6 ++++++
 5 files changed, 57 insertions(+), 11 deletions(-)


base-commit: 90fe3800b92a49173530828c0a17951abd30f0e1
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1810%2FUnique-Usman%2Fr_atoi-v5
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1810/Unique-Usman/r_atoi-v5
Pull-Request: https://github.com/git/git/pull/1810

Range-diff vs v4:

 1:  d9c997d7a9c = 1:  d9c997d7a9c daemon: replace atoi() with strtoul_ui() and strtol_i()
 2:  da9ea10e4e1 = 2:  da9ea10e4e1 merge: replace atoi() with strtol_i() for marker size validation
 3:  8982dca646d ! 3:  9b2b2dc8fc8 imap: replace atoi() with strtol_i() for UIDVALIDITY and UIDNEXT parsing
     @@ imap-send.c: static int parse_response_code(struct imap_store *ctx, struct imap_
       	} else if (cb && cb->ctx && !strcmp("APPENDUID", arg)) {
      -		if (!(arg = next_arg(&s)) || !(ctx->uidvalidity = atoi(arg)) ||
      -		    !(arg = next_arg(&s)) || !(*(int *)cb->ctx = atoi(arg))) {
     -+		if (!(arg = next_arg(&s)) || (strtol_i(arg, 10, &ctx->uidvalidity) || !ctx->uidvalidity) ||
     -+			!(arg = next_arg(&s)) || (strtol_i(arg, 10, (int *)cb->ctx) || !cb->ctx)) {
     ++		if (!(arg = next_arg(&s)) || strtol_i(arg, 10, &ctx->uidvalidity) || !ctx->uidvalidity ||
     ++		    !(arg = next_arg(&s)) || strtol_i(arg, 10, (int *)cb->ctx) || !cb->ctx) {
       			fprintf(stderr, "IMAP error: malformed APPENDUID status\n");
       			return RESP_BAD;
       		}

Comments

Patrick Steinhardt Oct. 23, 2024, 8:52 a.m. UTC | #1
On Wed, Oct 23, 2024 at 07:40:17AM +0000, Usman Akinyemi via GitGitGadget wrote:
> Changes from Version 4:
> 
>  * Fix incorrect indentation and remove unnecessary braces to avoid
>    confusion.

Thanks, this version looks good to me!

Patrick
Taylor Blau Oct. 23, 2024, 8:33 p.m. UTC | #2
On Wed, Oct 23, 2024 at 10:52:36AM +0200, Patrick Steinhardt wrote:
> On Wed, Oct 23, 2024 at 07:40:17AM +0000, Usman Akinyemi via GitGitGadget wrote:
> > Changes from Version 4:
> >
> >  * Fix incorrect indentation and remove unnecessary braces to avoid
> >    confusion.
>
> Thanks, this version looks good to me!

Thanks for reviewing. This one is looking pretty close, and I've moved
it to 'jch' in my tree, but I think there are still a few lingering
comments that I'd like to see addressed in a subsequent round before we
start merging this one down.

Thanks,
Taylor
Usman Akinyemi Oct. 24, 2024, 12:25 a.m. UTC | #3
On Wed, Oct 23, 2024 at 8:33 PM Taylor Blau <me@ttaylorr.com> wrote:
>
> On Wed, Oct 23, 2024 at 10:52:36AM +0200, Patrick Steinhardt wrote:
> > On Wed, Oct 23, 2024 at 07:40:17AM +0000, Usman Akinyemi via GitGitGadget wrote:
> > > Changes from Version 4:
> > >
> > >  * Fix incorrect indentation and remove unnecessary braces to avoid
> > >    confusion.
> >
> > Thanks, this version looks good to me!
>
> Thanks for reviewing. This one is looking pretty close, and I've moved
> it to 'jch' in my tree, but I think there are still a few lingering
> comments that I'd like to see addressed in a subsequent round before we
> start merging this one down.
>
Thanks to all the mentors, I really appreciate your time. I have sent
another round.
Usman.
> Thanks,
> Taylor