[PATCH v5 0/3] parse: replace atoi() with strtoul_ui() and strtol_i()
From: Usman Akinyemi via GitGitGadget <hidden>
Date: 2024-10-23 07:40:24
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;
}
--
gitgitgadget