avoid running over the array of locales in order.c when re-creating locales for tests.

This commit is contained in:
Enno Rehling 2014-12-29 23:53:00 +01:00
parent 43351e03cd
commit 95ab2826ec
1 changed files with 5 additions and 11 deletions

View File

@ -40,8 +40,7 @@ typedef struct locale_data {
const struct locale *lang; const struct locale *lang;
} locale_data; } locale_data;
static struct locale_data *locale_array[16]; static struct locale_data *locale_array[MAXLOCALES];
static int nlocales = 0;
typedef struct order_data { typedef struct order_data {
const char *_str; const char *_str;
@ -272,15 +271,10 @@ static order *create_order_i(keyword_t kwd, const char *sptr, int persistent,
} }
} }
for (lindex = 0; lindex != nlocales; ++lindex) { lindex = locale_index(lang);
if (locale_array[lindex]->lang == lang) assert(lindex < MAXLOCALES);
break; locale_array[lindex] = (locale_data *)calloc(1, sizeof(locale_data));
} locale_array[lindex]->lang = lang;
if (lindex == nlocales) {
locale_array[nlocales] = (locale_data *)calloc(1, sizeof(locale_data));
locale_array[nlocales]->lang = lang;
++nlocales;
}
ord = (order *)malloc(sizeof(order)); ord = (order *)malloc(sizeof(order));
ord->_persistent = persistent; ord->_persistent = persistent;