~emersion/mrsh-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH mrsh] shift: fix logic

Details
Message ID
<20230212230205.47946-1-seedoeldhopaul@gmail.com>
DKIM signature
missing
Download raw message
Patch: +8 -6
---
 builtin/shift.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/builtin/shift.c b/builtin/shift.c
index 5c582fc..c572f6d 100644
--- a/builtin/shift.c
@@ -40,13 +40,15 @@ int builtin_shift(struct mrsh_state *state, int argc, char *argv[]) {
		}
		return 1;
	}
	for (int i = 1, j = n + 1; j < state->frame->argc; ++i, ++j) {
		if (j <= state->frame->argc - n) {
			state->frame->argv[i] = state->frame->argv[j];
		} else {
			free(state->frame->argv[i]);
		}

	for (int i = 1; i < n; i++) {
		free(state->frame->argv[i]);
	}

	for (int i = 0, j = n; j < state->frame->argc; i++, j++) {
		state->frame->argv[i] = state->frame->argv[j];
	}

	state->frame->argc -= n;
	return 0;
}
-- 
2.39.1

[mrsh/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CQGYL56MFFX1.E3TFGNGB80MC@cirno2>
In-Reply-To
<20230212230205.47946-1-seedoeldhopaul@gmail.com> (view parent)
DKIM signature
missing
Download raw message
mrsh/patches: SUCCESS in 47s

[shift: fix logic][0] from [Seedo Paul][1]

[0]: https://lists.sr.ht/~emersion/mrsh-dev/patches/38960
[1]: seedoeldhopaul@gmail.com

✓ #939441 SUCCESS mrsh/patches/archlinux.yml https://builds.sr.ht/~emersion/job/939441
✓ #939442 SUCCESS mrsh/patches/freebsd.yml   https://builds.sr.ht/~emersion/job/939442
✓ #939440 SUCCESS mrsh/patches/alpine.yml    https://builds.sr.ht/~emersion/job/939440
Reply to thread Export thread (mbox)