From a091012bc03a43a3d62dc35769889d4a6fd8517d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Wed, 17 May 2023 16:05:34 +0800 Subject: Add prefix to custom option key --- ord.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ord.c b/ord.c index df5017f..62112c6 100644 --- a/ord.c +++ b/ord.c @@ -35,10 +35,11 @@ void interchange_ord_order(const char *sku, const char *item, order[2][1] = item; order[3][0] = "mv_order_quantity"; order[3][1] = qty_str; + static const char *prefix = "mv_order_"; for (size_t i = 0; i < nopts; i++) { const char **pair = options[i]; - order[4 + i][0] = malloc(strlen(pair[0]) + 1); - strcpy((char *)order[4 + i][0], pair[0]); + order[4 + i][0] = malloc(strlen(prefix) + strlen(pair[0]) + 1); + sprintf((char *)order[4 + i][0], "%s%s", prefix, pair[0]); order[4 + i][1] = malloc(strlen(pair[1]) + 1); strcpy((char *)order[4 + i][1], pair[1]); } -- cgit v1.2.3