[Groonga-commit] ranguba/rroonga at 52c10bd [master] Use grn_obj_is_scalar_column()

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Apr 25 16:25:15 JST 2017


Kouhei Sutou	2017-04-25 16:25:15 +0900 (Tue, 25 Apr 2017)

  New Revision: 52c10bd63d6dbf196a321285b878a94032b61226
  https://github.com/ranguba/rroonga/commit/52c10bd63d6dbf196a321285b878a94032b61226

  Message:
    Use grn_obj_is_scalar_column()

  Modified files:
    ext/groonga/rb-grn-column.c

  Modified: ext/groonga/rb-grn-column.c (+12 -26)
===================================================================
--- ext/groonga/rb-grn-column.c    2017-04-25 16:21:34 +0900 (e9f7a87)
+++ ext/groonga/rb-grn-column.c    2017-04-25 16:25:15 +0900 (d8daba6)
@@ -609,12 +609,11 @@ rb_grn_column_truncate (VALUE self)
 }
 
 /*
- * _column_ が {Groonga::IndexColumn} の場合は +true+ を返し、
- * そうでない場合は +false+ を返す。
+ * @overload index?
+ *   @return [Bool] `true` if the column is an index column
+ *     ({Groonga::IndexColumn}), `false` otherwise.
  *
  * @since 1.0.5
- *
- * @overload index?
  */
 static VALUE
 rb_grn_column_index_p (VALUE self)
@@ -634,12 +633,11 @@ rb_grn_column_index_p (VALUE self)
 }
 
 /*
- * _column_ がベクターカラムの場合は +true+ を返し、
- * そうでない場合は +false+ を返す。
+ * @overload vector?
+ *   @return [Bool] `true` if the column is a vector column,
+ *     `false` otherwise.
  *
  * @since 1.0.5
- *
- * @overload vector?
  */
 static VALUE
 rb_grn_column_vector_p (VALUE self)
@@ -657,7 +655,7 @@ rb_grn_column_vector_p (VALUE self)
 /*
  * @overload weight_vector?
  *   @return [Bool] `true` if the column is a weight vector column,
- *   `false` otherwise.
+ *     `false` otherwise.
  *
  * @since 7.0.2
  */
@@ -675,41 +673,29 @@ rb_grn_column_weight_vector_p (VALUE self)
 }
 
 /*
- * _column_ がスカラーカラムの場合は +true+ を返し、
- * そうでない場合は +false+ を返す。
+ * @overload scalar?
+ *   @return [Bool] `true` if the column is a scalar column,
+ *     `false` otherwise.
  *
  * @since 1.0.5
- *
- * @overload scalar?
  */
 static VALUE
 rb_grn_column_scalar_p (VALUE self)
 {
     grn_ctx *context;
     grn_obj *column;
-    grn_column_flags flags;
-    grn_column_flags column_type;
 
     rb_grn_column_deconstruct(SELF(self), &column, &context,
                              NULL, NULL,
                              NULL, NULL, NULL);
 
-    switch (column->header.type) {
-    case GRN_COLUMN_FIX_SIZE:
-        return Qtrue;
-    case GRN_COLUMN_VAR_SIZE:
-        flags = grn_column_get_flags(context, column);
-        column_type = (flags & GRN_OBJ_COLUMN_TYPE_MASK);
-        return CBOOL2RVAL(column_type == GRN_OBJ_COLUMN_SCALAR);
-    default:
-        return Qfalse;
-    }
+    return CBOOL2RVAL(grn_obj_is_scalar_column(context, column));
 }
 
 /*
  * @overload data?
  *   @return [Bool] `true` if the column is a data column (a scalar
- *   column or a vector column), `false` otherwise.
+ *     column or a vector column), `false` otherwise.
  *
  * @since 7.0.2
  */
-------------- next part --------------
HTML����������������������������...
Télécharger 



More information about the Groonga-commit mailing list
Back to archive index