[Groonga-commit] groonga/groonga at 1dfa932 [master] Add grn_expr_append_const_bool

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Mar 24 15:17:52 JST 2018


Kouhei Sutou	2018-03-24 15:17:52 +0900 (Sat, 24 Mar 2018)

  New Revision: 1dfa932e9af53f10568fe2f41b4b0f5328b7289d
  https://github.com/groonga/groonga/commit/1dfa932e9af53f10568fe2f41b4b0f5328b7289d

  Message:
    Add grn_expr_append_const_bool

  Modified files:
    include/groonga/expr.h
    lib/expr.c

  Modified: include/groonga/expr.h (+5 -0)
===================================================================
--- include/groonga/expr.h    2018-03-26 18:38:30 +0900 (0665f7f59)
+++ include/groonga/expr.h    2018-03-24 15:17:52 +0900 (1084b3ae9)
@@ -54,6 +54,11 @@ GRN_API grn_obj *grn_expr_append_const_str(grn_ctx *ctx, grn_obj *expr,
                                            grn_operator op, int nargs);
 GRN_API grn_obj *grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
                                            grn_operator op, int nargs);
+GRN_API grn_obj *grn_expr_append_const_bool(grn_ctx *ctx,
+                                            grn_obj *expr,
+                                            grn_bool value,
+                                            grn_operator op,
+                                            int nargs);
 GRN_API grn_rc grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs);
 
 GRN_API grn_rc grn_expr_get_keywords(grn_ctx *ctx, grn_obj *expr, grn_obj *keywords);

  Modified: lib/expr.c (+15 -0)
===================================================================
--- lib/expr.c    2018-03-26 18:38:30 +0900 (b7a6726e8)
+++ lib/expr.c    2018-03-24 15:17:52 +0900 (5e8d487bd)
@@ -1427,6 +1427,21 @@ grn_expr_append_const_int(grn_ctx *ctx, grn_obj *expr, int i,
   GRN_API_RETURN(res);
 }
 
+grn_obj *
+grn_expr_append_const_bool(grn_ctx *ctx, grn_obj *expr, grn_bool value,
+                           grn_operator op, int nargs)
+{
+  grn_obj *res = NULL;
+  GRN_API_ENTER;
+  if ((res = grn_expr_alloc_const(ctx, expr))) {
+    GRN_BOOL_INIT(res, 0);
+    GRN_BOOL_SET(ctx, res, value);
+    res->header.impl_flags |= GRN_OBJ_EXPRCONST;
+  }
+  grn_expr_append_obj(ctx, expr, res, op, nargs); /* constant */
+  GRN_API_RETURN(res);
+}
+
 grn_rc
 grn_expr_append_op(grn_ctx *ctx, grn_obj *expr, grn_operator op, int nargs)
 {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180324/d4374ab4/attachment.htm 



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