[Groonga-commit] groonga/groonga at 2c390e1 [master] Add GRN_RAW_STRING_EQUAL_CSTRING internal convenient macro

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Aug 21 00:33:33 JST 2017


Kouhei Sutou	2017-08-21 00:33:33 +0900 (Mon, 21 Aug 2017)

  New Revision: 2c390e1ae473956ac5862b636550bfb4e4bf715a
  https://github.com/groonga/groonga/commit/2c390e1ae473956ac5862b636550bfb4e4bf715a

  Message:
    Add GRN_RAW_STRING_EQUAL_CSTRING internal convenient macro

  Modified files:
    lib/grn_raw_string.h

  Modified: lib/grn_raw_string.h (+6 -0)
===================================================================
--- lib/grn_raw_string.h    2017-08-21 00:28:25 +0900 (9aa3e81a3)
+++ lib/grn_raw_string.h    2017-08-21 00:33:33 +0900 (b115ad838)
@@ -44,6 +44,12 @@ extern "C" {
     string.length = GRN_TEXT_LEN(bulk);          \
   }
 
+#define GRN_RAW_STRING_EQUAL_CSTRING(string, cstring)           \
+  (cstring ?                                                    \
+   (string.length == strlen(cstring) &&                         \
+    memcmp(string.value, cstring, string.length) == 0) :        \
+   (string.length == 0))
+
 typedef struct {
   const char *value;
   size_t length;
-------------- next part --------------
HTML����������������������������...
Download 



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