Kouhei Sutou
null+****@clear*****
Fri Jan 25 16:59:01 JST 2013
Kouhei Sutou 2013-01-25 16:59:01 +0900 (Fri, 25 Jan 2013) New Revision: aff5d9c5c9f569695f481ed2d4e780971bd6960f https://github.com/groonga/groonga/commit/aff5d9c5c9f569695f481ed2d4e780971bd6960f Log: Export grn_strtoenc() grn_strtoenc() -> grn_encoding_parse() Use grn_encoding_ prefix for public API. Modified files: include/groonga.h lib/ctx.c lib/str.c lib/str.h src/groonga.c Modified: include/groonga.h (+11 -0) =================================================================== --- include/groonga.h 2013-01-25 16:57:50 +0900 (497fb35) +++ include/groonga.h 2013-01-25 16:59:01 +0900 (7177716) @@ -375,6 +375,17 @@ GRN_API grn_rc grn_set_default_match_escalation_threshold(long long int threshol **/ GRN_API const char *grn_encoding_to_string(grn_encoding encoding); +/** + * grn_encoding_parse: + * @name: The encoding name. + * + * Parses encoding name and returns grn_encoding. + * For example, 'grn_encoding_to_string("UTF8")' returns 'GRN_ENC_UTF8'. + * + * 'GRN_ENC_UTF8' is returned for invalid encoding name. + **/ +GRN_API grn_encoding grn_encoding_parse(const char *name); + /* obj */ typedef unsigned short int grn_obj_flags; Modified: lib/ctx.c (+2 -2) =================================================================== --- lib/ctx.c 2013-01-25 16:57:50 +0900 (5487805) +++ lib/ctx.c 2013-01-25 16:59:01 +0900 (24208ea) @@ -1172,7 +1172,7 @@ grn_init(void) ctx->next = ctx; ctx->prev = ctx; grn_ctx_init(ctx, 0); - ctx->encoding = grn_strtoenc(GRN_DEFAULT_ENCODING); + ctx->encoding = grn_encoding_parse(GRN_DEFAULT_ENCODING); grn_timeval_now(ctx, &grn_starttime); #ifdef WIN32 { @@ -1269,7 +1269,7 @@ grn_set_default_encoding(grn_encoding encoding) { switch (encoding) { case GRN_ENC_DEFAULT : - grn_gctx.encoding = grn_strtoenc(GRN_DEFAULT_ENCODING); + grn_gctx.encoding = grn_encoding_parse(GRN_DEFAULT_ENCODING); return GRN_SUCCESS; case GRN_ENC_NONE : case GRN_ENC_EUC_JP : Modified: lib/str.c (+1 -1) =================================================================== --- lib/str.c 2013-01-25 16:57:50 +0900 (6aa34b3) +++ lib/str.c 2013-01-25 16:59:01 +0900 (5672c83) @@ -1294,7 +1294,7 @@ grn_encoding_to_string(grn_encoding enc) } grn_encoding -grn_strtoenc(const char *str) +grn_encoding_parse(const char *str) { grn_encoding e = GRN_ENC_UTF8; int i = sizeof(grn_enc_string) / sizeof(grn_enc_string[0]); Modified: lib/str.h (+0 -1) =================================================================== --- lib/str.h 2013-01-25 16:57:50 +0900 (06a825b) +++ lib/str.h 2013-01-25 16:59:01 +0900 (714b0d4) @@ -63,7 +63,6 @@ grn_rc grn_itoa(int i, char *p, char *end, char **rest); grn_rc grn_lltoa(int64_t i, char *p, char *end, char **rest); grn_rc grn_ulltoa(uint64_t i, char *p, char *end, char **rest); GRN_API grn_rc grn_aton(grn_ctx *ctx, const char *p, const char *end, const char **rest, grn_obj *res); -GRN_API grn_encoding grn_strtoenc(const char *str); GRN_API void grn_itoh(unsigned int i, char *p, unsigned int len); int grn_str_tok(const char *str, size_t str_len, char delim, const char **tokbuf, int buf_size, const char **rest); Modified: src/groonga.c (+1 -1) =================================================================== --- src/groonga.c 2013-01-25 16:57:50 +0900 (9890c35) +++ src/groonga.c 2013-01-25 16:59:01 +0900 (549d34c) @@ -1825,7 +1825,7 @@ init_default_settings(void) { output = stdout; - default_encoding = grn_strtoenc(GRN_DEFAULT_ENCODING); + default_encoding = grn_encoding_parse(GRN_DEFAULT_ENCODING); { const uint32_t num_cores = get_core_number(); -------------- next part -------------- HTML����������������������������... Descargar