[Groonga-commit] groonga/groonga at 8be809b [master] Improve command version 1 output format detection

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri May 20 11:33:11 JST 2016


Kouhei Sutou	2016-05-20 11:33:11 +0900 (Fri, 20 May 2016)

  New Revision: 8be809bf88ce0c5ffd4cd15a6ebc4e9a7e23716e
  https://github.com/groonga/groonga/commit/8be809bf88ce0c5ffd4cd15a6ebc4e9a7e23716e

  Message:
    Improve command version 1 output format detection

  Modified files:
    lib/output.c

  Modified: lib/output.c (+30 -7)
===================================================================
--- lib/output.c    2016-05-20 11:17:33 +0900 (222e8ed)
+++ lib/output.c    2016-05-20 11:33:11 +0900 (ed2805f)
@@ -2198,17 +2198,40 @@ is_output_columns_format_v1(grn_ctx *ctx,
                             const char *output_columns,
                             unsigned int output_columns_len)
 {
-  unsigned int i;
+  const char *current;
+  const char *end;
 
-  for (i = 0; i < output_columns_len; i++) {
-    switch (output_columns[i]) {
-    case ',' :
-    case '(' :
-    case '[' :
+  current = output_columns;
+  end = current + output_columns_len;
+  while (current < end) {
+    int char_length;
+
+    char_length = grn_charlen(ctx, current, end);
+    if (char_length != 1) {
       return GRN_FALSE;
-    default :
+    }
+
+    switch (current[0]) {
+    case ' ' :
+    case '.' :
+    case '_' :
+    case '-' :
+    case '#' :
+    case '@' :
       break;
+    default :
+      if ('a' <= current[0] && current[0] <= 'z') {
+        break;
+      } else if ('A' <= current[0] && current[0] <= 'Z') {
+        break;
+      } else if ('0' <= current[0] && current[0] <= '9') {
+        break;
+      } else {
+        return GRN_FALSE;
+      }
     }
+
+    current += char_length;
   }
 
   return GRN_TRUE;
-------------- next part --------------
HTML����������������������������...
ダウンロード 



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