6
6
*/
7
7
#include "postgres.h"
8
8
9
- #include "utils/elog.h"
10
- #include "utils/palloc.h"
9
+ #include <locale.h>
10
+
11
11
#include "utils/builtins.h"
12
- #include "catalog/pg_control.h"
13
- #include "utils/pg_locale.h"
14
12
15
13
#include "morph.h"
16
14
#include "deflex.h"
25
23
*/
26
24
typedef struct
27
25
{
28
- char localename [LOCALE_NAME_BUFLEN ];
26
+ char localename [NAMEDATALEN ];
29
27
/* init dictionary */
30
28
void * (* init ) (void );
31
29
/* close dictionary */
@@ -52,9 +50,8 @@ DICTdicts[] = {
52
50
53
51
#undef DICT_TABLE
54
52
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 )];
58
55
59
56
#define STOPLEXEM -2
60
57
#define BYLOCALE -1
@@ -104,24 +101,24 @@ initmorph(void)
104
101
k ;
105
102
MAPDICT * md ;
106
103
bool needinit [lengthof (dicts )];
107
- PG_LocaleCategories lc ;
108
-
104
+ const char * curlocale ;
109
105
int bylocaledict = NODICT ;
110
106
111
107
if (inited )
112
108
return ;
113
109
for (i = 1 ;i < lengthof (dicts );i ++ )
114
110
needinit [i ]= false;
115
111
116
- PGLC_current (& lc );
117
- if (lc .lc_ctype )
112
+ curlocale = setlocale (LC_CTYPE ,NULL );
113
+ if (curlocale )
114
+ {
118
115
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 )
120
117
{
121
118
bylocaledict = i ;
122
119
break ;
123
120
}
124
- PGLC_free_categories ( & lc );
121
+ }
125
122
126
123
for (i = 1 ;i < lengthof (mapdict );i ++ )
127
124
{