[Groonga-commit] groonga/groonga at bd85afa [master] grn_ts: add grn_ts_byte_is_decimal()

アーカイブの一覧に戻る

susumu.yata null+****@clear*****
Thu Sep 17 12:06:30 JST 2015


susumu.yata	2015-09-17 12:06:30 +0900 (Thu, 17 Sep 2015)

  New Revision: bd85afa8dd6cd9f707a7262ec1d9fa50232d075b
  https://github.com/groonga/groonga/commit/bd85afa8dd6cd9f707a7262ec1d9fa50232d075b

  Message:
    grn_ts: add grn_ts_byte_is_decimal()
    
    GitHub: #404

  Modified files:
    lib/ts.c

  Modified: lib/ts.c (+7 -1)
===================================================================
--- lib/ts.c    2015-09-17 11:48:25 +0900 (513f43b)
+++ lib/ts.c    2015-09-17 12:06:30 +0900 (1c3bc00)
@@ -47,6 +47,12 @@ enum { GRN_TS_BATCH_SIZE = 1024 };
  * grn_ts_str.
  */
 
+/* grn_ts_byte_is_decimal() returns whether or not a byte is decimal. */
+inline static grn_ts_bool
+grn_ts_byte_is_decimal(unsigned char byte) {
+  return (byte >= '0') && (byte <= '9');
+}
+
 /*
  * grn_ts_byte_is_name_char() returns whether or not a byte is allowed as a
  * part of a name.
@@ -4396,7 +4402,7 @@ grn_ts_expr_parser_tokenize_next(grn_ctx *ctx, grn_ts_expr_parser *parser,
       break;
     }
     case '.': {
-      if ((rest.size >= 2) && isdigit((unsigned char)rest.ptr[1])) {
+      if ((rest.size >= 2) && grn_ts_byte_is_decimal(rest.ptr[1])) {
         rc = grn_ts_expr_parser_tokenize_number(ctx, parser, rest, &new_token);
       } else {
         // TODO: Dereferencing is not supported yet.
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る