Fix compile errors.

This commit is contained in:
Tom Lane 2002-09-05 20:51:39 +00:00
parent b73d8d22f7
commit 5d1c8a3b07

View File

@ -6,11 +6,9 @@
*/ */
#include "postgres.h" #include "postgres.h"
#include "utils/elog.h" #include <locale.h>
#include "utils/palloc.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "catalog/pg_control.h"
#include "utils/pg_locale.h"
#include "morph.h" #include "morph.h"
#include "deflex.h" #include "deflex.h"
@ -25,7 +23,7 @@
*/ */
typedef struct typedef struct
{ {
char localename[LOCALE_NAME_BUFLEN]; char localename[NAMEDATALEN];
/* init dictionary */ /* init dictionary */
void *(*init) (void); void *(*init) (void);
/* close dictionary */ /* close dictionary */
@ -52,9 +50,8 @@ DICT dicts[] = {
#undef DICT_TABLE #undef DICT_TABLE
/* array for storing dictinary's objects (if needed) */ /* array for storing dictionary's objects (if needed) */
void *dictobjs[ void *dictobjs[lengthof(dicts)];
lengthof(dicts)];
#define STOPLEXEM -2 #define STOPLEXEM -2
#define BYLOCALE -1 #define BYLOCALE -1
@ -104,8 +101,7 @@ initmorph(void)
k; k;
MAPDICT *md; MAPDICT *md;
bool needinit[lengthof(dicts)]; bool needinit[lengthof(dicts)];
PG_LocaleCategories lc; const char *curlocale;
int bylocaledict = NODICT; int bylocaledict = NODICT;
if (inited) if (inited)
@ -113,15 +109,16 @@ initmorph(void)
for (i = 1; i < lengthof(dicts); i++) for (i = 1; i < lengthof(dicts); i++)
needinit[i] = false; needinit[i] = false;
PGLC_current(&lc); curlocale = setlocale(LC_CTYPE, NULL);
if (lc.lc_ctype) if (curlocale)
{
for (i = 1; i < lengthof(dicts); i++) for (i = 1; i < lengthof(dicts); i++)
if (strcmp(dicts[i].localename, lc.lc_ctype) == 0) if (strcmp(dicts[i].localename, curlocale) == 0)
{ {
bylocaledict = i; bylocaledict = i;
break; break;
} }
PGLC_free_categories(&lc); }
for (i = 1; i < lengthof(mapdict); i++) for (i = 1; i < lengthof(mapdict); i++)
{ {