[Groonga-commit] groonga/groonga at 99f0a78 [master] windows: use memmove_s() on Windows

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Apr 16 00:03:24 JST 2015


Kouhei Sutou	2015-04-16 00:03:24 +0900 (Thu, 16 Apr 2015)

  New Revision: 99f0a78b3331f234a201c49a729ccb101c0bc28a
  https://github.com/groonga/groonga/commit/99f0a78b3331f234a201c49a729ccb101c0bc28a

  Message:
    windows: use memmove_s() on Windows

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

  Modified: include/groonga/portability.h (+6 -0)
===================================================================
--- include/groonga/portability.h    2015-04-15 23:58:51 +0900 (d501973)
+++ include/groonga/portability.h    2015-04-16 00:03:24 +0900 (0d6686a)
@@ -32,6 +32,12 @@
 # endif /* __cplusplus */
 #endif /* WIN32 */
 
+#ifdef WIN32
+# define grn_memmove(dest, src, n) memmove_s((dest), (n), (src), (n))
+#else /* WIN32 */
+# define grn_memmove(dest, src, n) memmove((dest), (n), (src), (n))
+#endif /* WIN32 */
+
 #define GRN_ENV_BUFFER_SIZE 1024
 
 #ifdef WIN32

  Modified: lib/expr.c (+3 -3)
===================================================================
--- lib/expr.c    2015-04-15 23:58:51 +0900 (4af0849)
+++ lib/expr.c    2015-04-16 00:03:24 +0900 (07e2408)
@@ -3612,7 +3612,7 @@ put_logical_op(grn_ctx *ctx, scan_info **sis, int *ip, grn_operator op, int star
               s_->flags &= ~SCAN_PUSH;
               s_->logical_op = op;
               grn_memcpy(&sis[i], &sis[j], sizeof(scan_info *) * (r - j));
-              memmove(&sis[j], &sis[r], sizeof(scan_info *) * (i - r));
+              grn_memmove(&sis[j], &sis[r], sizeof(scan_info *) * (i - r));
               grn_memcpy(&sis[i + j - r], &sis[i], sizeof(scan_info *) * (r - j));
             }
             break;
@@ -3812,10 +3812,10 @@ scan_info_put_index(grn_ctx *ctx, scan_info *si,
       if (index == pi[-1]) {
         if (i) {
           int32_t *pw = &GRN_INT32_VALUE_AT(&si->wv, (ni - i) * 2);
-          memmove(pw + 2, pw, sizeof(int32_t) * 2 * i);
+          grn_memmove(pw + 2, pw, sizeof(int32_t) * 2 * i);
           pw[0] = (int32_t) sid;
           pw[1] = weight;
-          memmove(pi + 1, pi, sizeof(grn_obj *) * i);
+          grn_memmove(pi + 1, pi, sizeof(grn_obj *) * i);
           pi[0] = index;
         }
         return;

  Modified: lib/str.c (+1 -1)
===================================================================
--- lib/str.c    2015-04-15 23:58:51 +0900 (b33596c)
+++ lib/str.c    2015-04-16 00:03:24 +0900 (e1f35fa)
@@ -2097,7 +2097,7 @@ ftoa_(grn_ctx *ctx, grn_obj *buf, double d)
     curr[len] = '\0';
     if ((p = strchr(curr, 'e'))) {
       for (q = p; *(q - 2) != '.' && *(q - 1) == '0'; q--) { len--; }
-      memmove(q, p, curr + len - q);
+      grn_memmove(q, p, curr + len - q);
     } else {
       for (q = curr + len; *(q - 2) != '.' && *(q - 1) == '0'; q--) { len--; }
     }
-------------- next part --------------
HTML����������������������������...
다운로드 



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