From bf00a9a9940336ab8d05bcf350c5ca03f8617e00 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 13 Aug 2020 16:20:52 +0200 Subject: [PATCH] create_data: remove short-lived allocation. --- src/kernel/order.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/kernel/order.c b/src/kernel/order.c index e82764cab..f3b30719e 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -252,8 +252,7 @@ void free_orders(order ** olist) static int create_data(keyword_t kwd, const char *s, const struct locale *lang) { - order_data *data; - int id; + order_data data = { NULL, 0 }; assert(kwd != NOKEYWORD); @@ -267,12 +266,8 @@ static int create_data(keyword_t kwd, const char *s, return ((int)sk)-100; } } - /* TODO: between mkdata and odata_release, this object is very - * short-lived. */ - odata_create(&data, strlen(s), s); - id = odata_save(data); - odata_release(data); - return id; + data._str = s; + return odata_save(&data); } static void create_order_i(order *ord, keyword_t kwd, const char *sptr, bool persistent,