Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
38ea795b
Commit
38ea795b
authored
May 29, 2020
by
Kentoku SHIBA
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a counter to avoid multiple initialization of Groonga mecab tokenizer
parent
6e6a4227
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
0 deletions
+12
-0
storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
+1
-0
storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
+11
-0
No files found.
storage/mroonga/vendor/groonga/lib/grn_tokenizers.h
View file @
38ea795b
...
...
@@ -30,6 +30,7 @@ grn_rc grn_tokenizers_init(void);
grn_rc
grn_tokenizers_fin
(
void
);
grn_rc
grn_db_init_mecab_tokenizer
(
grn_ctx
*
ctx
);
void
grn_db_fin_mecab_tokenizer
(
grn_ctx
*
ctx
);
grn_rc
grn_db_init_builtin_tokenizers
(
grn_ctx
*
ctx
);
#ifdef __cplusplus
...
...
storage/mroonga/vendor/groonga/plugins/tokenizers/mecab.c
View file @
38ea795b
...
...
@@ -31,6 +31,7 @@
#include <string.h>
#include <ctype.h>
static
unsigned
int
sole_mecab_init_counter
=
0
;
static
mecab_t
*
sole_mecab
=
NULL
;
static
grn_plugin_mutex
*
sole_mecab_mutex
=
NULL
;
static
grn_encoding
sole_mecab_encoding
=
GRN_ENC_NONE
;
...
...
@@ -563,6 +564,11 @@ check_mecab_dictionary_encoding(grn_ctx *ctx)
grn_rc
GRN_PLUGIN_INIT
(
grn_ctx
*
ctx
)
{
++
sole_mecab_init_counter
;
if
(
sole_mecab_init_counter
>
1
)
{
return
GRN_SUCCESS
;
}
{
char
env
[
GRN_ENV_BUFFER_SIZE
];
...
...
@@ -636,6 +642,11 @@ GRN_PLUGIN_REGISTER(grn_ctx *ctx)
grn_rc
GRN_PLUGIN_FIN
(
grn_ctx
*
ctx
)
{
--
sole_mecab_init_counter
;
if
(
sole_mecab_init_counter
>
0
)
{
return
GRN_SUCCESS
;
}
if
(
sole_mecab
)
{
mecab_destroy
(
sole_mecab
);
sole_mecab
=
NULL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment