one short order to rule them all.

This commit is contained in:
Enno Rehling 2017-09-30 20:09:30 +02:00
parent e50c421b3f
commit 03f46e35c4
1 changed files with 5 additions and 7 deletions

View File

@ -35,7 +35,7 @@
# define ORD_STRING(ord) (ord)->data->_str # define ORD_STRING(ord) (ord)->data->_str
typedef struct locale_data { typedef struct locale_data {
struct order_data *short_orders[MAXKEYWORDS]; struct order_data *short_orders;
struct order_data *study_orders[MAXSKILLS]; struct order_data *study_orders[MAXSKILLS];
const struct locale *lang; const struct locale *lang;
} locale_data; } 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 */ /* orders with no parameter, only one order_data per order required */
else if (kwd != NOKEYWORD && *sptr == 0) { else if (kwd != NOKEYWORD && *sptr == 0) {
data = locale_array[lindex]->short_orders[kwd]; data = locale_array[lindex]->short_orders;
if (data == NULL) { if (data == NULL) {
mkdata(&data, 0, lindex, 0); mkdata(&data, 0, lindex, 0);
data->_refcount = 1; data->_refcount = 1;
locale_array[lindex]->short_orders[kwd] = data; locale_array[lindex]->short_orders = data;
} }
++data->_refcount; ++data->_refcount;
return data; 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) { static void clear_localedata(int lindex) {
int i; int i;
for (i = 0; i != MAXKEYWORDS; ++i) { release_data(locale_array[lindex]->short_orders);
release_data(locale_array[lindex]->short_orders[i]); locale_array[lindex]->short_orders = NULL;
locale_array[lindex]->short_orders[i] = 0;
}
for (i = 0; i != MAXSKILLS; ++i) { for (i = 0; i != MAXSKILLS; ++i) {
release_data(locale_array[lindex]->study_orders[i]); release_data(locale_array[lindex]->study_orders[i]);
locale_array[lindex]->study_orders[i] = 0; locale_array[lindex]->study_orders[i] = 0;