diff options
-rw-r--r-- | ord.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -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]); |