From 03f46e35c4e28f2712d61a7806a37681b6ed8324 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 30 Sep 2017 20:09:30 +0200 Subject: [PATCH] one short order to rule them all. --- src/kernel/order.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/kernel/order.c b/src/kernel/order.c index 03af9be5d..a48825333 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -35,7 +35,7 @@ # define ORD_STRING(ord) (ord)->data->_str typedef struct locale_data { - struct order_data *short_orders[MAXKEYWORDS]; + struct order_data *short_orders; struct order_data *study_orders[MAXSKILLS]; const struct locale *lang; } locale_data; @@ -243,11 +243,11 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex) /* orders with no parameter, only one order_data per order required */ else if (kwd != NOKEYWORD && *sptr == 0) { - data = locale_array[lindex]->short_orders[kwd]; + data = locale_array[lindex]->short_orders; if (data == NULL) { mkdata(&data, 0, lindex, 0); data->_refcount = 1; - locale_array[lindex]->short_orders[kwd] = data; + locale_array[lindex]->short_orders = data; } ++data->_refcount; return data; @@ -259,10 +259,8 @@ static order_data *create_data(keyword_t kwd, const char *sptr, int lindex) static void clear_localedata(int lindex) { int i; - for (i = 0; i != MAXKEYWORDS; ++i) { - release_data(locale_array[lindex]->short_orders[i]); - locale_array[lindex]->short_orders[i] = 0; - } + release_data(locale_array[lindex]->short_orders); + locale_array[lindex]->short_orders = NULL; for (i = 0; i != MAXSKILLS; ++i) { release_data(locale_array[lindex]->study_orders[i]); locale_array[lindex]->study_orders[i] = 0;