Kouhei Sutou
null+****@clear*****
Wed Jan 29 13:44:33 JST 2014
Kouhei Sutou 2014-01-29 13:44:33 +0900 (Wed, 29 Jan 2014) New Revision: 6af5f8ae608d57f147f6f3a253d7110944808de4 https://github.com/groonga/groonga-normalizer-mysql/commit/6af5f8ae608d57f147f6f3a253d7110944808de4 Message: Add '\0' to the end of normalized text It is not required but it is useful to treat the normalized text as C string instead of pointer and length string. [groonga-dev,02086] Suggested by Naoya Murakami. Thanks!!! Modified files: normalizers/mysql.c Modified: normalizers/mysql.c (+3 -1) =================================================================== --- normalizers/mysql.c 2014-01-29 10:54:43 +0900 (e1820af) +++ normalizers/mysql.c 2014-01-29 13:44:33 +0900 (2988721) @@ -313,7 +313,8 @@ normalize(grn_ctx *ctx, grn_obj *string, remove_blank_p = flags & GRN_STRING_REMOVE_BLANK; grn_string_get_original(ctx, string, &original, &original_length_in_bytes); { - unsigned int max_normalized_length_in_bytes = original_length_in_bytes; + unsigned int max_normalized_length_in_bytes = + original_length_in_bytes + 1; normalized = GRN_PLUGIN_MALLOC(ctx, max_normalized_length_in_bytes); } if (flags & GRN_STRING_WITH_TYPES) { @@ -391,6 +392,7 @@ normalize(grn_ctx *ctx, grn_obj *string, if (current_type) { current_type[0] = GRN_CHAR_NULL; } + normalized[normalized_length_in_bytes] = '\0'; if (rest_length > 0) { char buffer[SNIPPET_BUFFER_SIZE]; -------------- next part -------------- HTML����������������������������...Download