Skip to content

Commit 5d1c8a3

Browse files
committed
Fix compile errors.
1 parent b73d8d2 commit 5d1c8a3

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

contrib/tsearch/morph.c

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@
66
*/
77
#include "postgres.h"
88

9-
#include "utils/elog.h"
10-
#include "utils/palloc.h"
9+
#include <locale.h>
10+
1111
#include "utils/builtins.h"
12-
#include "catalog/pg_control.h"
13-
#include "utils/pg_locale.h"
1412

1513
#include "morph.h"
1614
#include "deflex.h"
@@ -25,7 +23,7 @@
2523
*/
2624
typedef struct
2725
{
28-
char localename[LOCALE_NAME_BUFLEN];
26+
char localename[NAMEDATALEN];
2927
/* init dictionary */
3028
void *(*init) (void);
3129
/* close dictionary */
@@ -52,9 +50,8 @@ DICT dicts[] = {
5250

5351
#undef DICT_TABLE
5452

55-
/* array for storing dictinary's objects (if needed) */
56-
void *dictobjs[
57-
lengthof(dicts)];
53+
/* array for storing dictionary's objects (if needed) */
54+
void *dictobjs[lengthof(dicts)];
5855

5956
#define STOPLEXEM -2
6057
#define BYLOCALE -1
@@ -104,24 +101,24 @@ initmorph(void)
104101
k;
105102
MAPDICT *md;
106103
bool needinit[lengthof(dicts)];
107-
PG_LocaleCategories lc;
108-
104+
const char *curlocale;
109105
int bylocaledict = NODICT;
110106

111107
if (inited)
112108
return;
113109
for (i = 1; i < lengthof(dicts); i++)
114110
needinit[i] = false;
115111

116-
PGLC_current(&lc);
117-
if (lc.lc_ctype)
112+
curlocale = setlocale(LC_CTYPE, NULL);
113+
if (curlocale)
114+
{
118115
for (i = 1; i < lengthof(dicts); i++)
119-
if (strcmp(dicts[i].localename, lc.lc_ctype) == 0)
116+
if (strcmp(dicts[i].localename, curlocale) == 0)
120117
{
121118
bylocaledict = i;
122119
break;
123120
}
124-
PGLC_free_categories(&lc);
121+
}
125122

126123
for (i = 1; i < lengthof(mapdict); i++)
127124
{

0 commit comments

Comments
 (0)