summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-05-23 15:44:34 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-05-23 15:44:34 +0800
commit98de18c4a1881cdd38e00eb4e07664a9c9c6a1f6 (patch)
treee589e469290f6b0e66b418fd7f4906d30f5d0eb9
parentec05878378bf14ad85aa07a9762ea00b99bc672f (diff)
No options shouldn't iterate to -1
-rw-r--r--ord.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ord.c b/ord.c
index 9e15a5b..c1f79cc 100644
--- a/ord.c
+++ b/ord.c
@@ -25,9 +25,7 @@ void interchange_ord_order(const char *sku, const char *item,
}
for (size_t i = 0; i < nopts; i++)
--options;
- if (nopts)
- nopts++;
- size_t total_nopts = 4 + nopts;
+ size_t total_nopts = 4 + (nopts ? 1 : 0) + nopts;
const char *order[total_nopts + 1][2];
order[0][0] = "mv_action";
order[0][1] = "refresh";
@@ -42,7 +40,7 @@ void interchange_ord_order(const char *sku, const char *item,
order[4][0] = "mv_form_profile";
order[4][1] = "check_opt";
}
- for (size_t i = 0; i < nopts - 1; i++) {
+ for (size_t i = 0; i < nopts; i++) {
const char **pair = options[i];
order[5 + i][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1);
sprintf((char *)order[5 + i][0], "%s%s", prefix, pair[0]);