[Groonga-commit] groonga/groonga at 0aea14f [master] Use GRN_FMT_INT64 instead of "%ld" for portability

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Nov 15 14:31:41 JST 2015


Kouhei Sutou	2015-11-15 14:31:41 +0900 (Sun, 15 Nov 2015)

  New Revision: 0aea14f08923d0724a5143082b93ec225f83fe85
  https://github.com/groonga/groonga/commit/0aea14f08923d0724a5143082b93ec225f83fe85

  Message:
    Use GRN_FMT_INT64 instead of "%ld" for portability

  Modified files:
    lib/grn.h
    lib/ts/ts_expr_node.c

  Modified: lib/grn.h (+3 -0)
===================================================================
--- lib/grn.h    2015-11-15 14:28:15 +0900 (2e9edf9)
+++ lib/grn.h    2015-11-15 14:31:41 +0900 (79f7993)
@@ -484,6 +484,9 @@ typedef int grn_cond;
 # define GRN_FMT_OFF64_T "jd"
 #endif /* WIN32 */
 
+#define GRN_FMT_INT64  GRN_FMT_LLD
+#define GRN_FMT_UINT64 GRN_FMT_LLU
+
 #ifdef __GNUC__
 # if (defined(__i386__) || defined(__x86_64__)) /* ATOMIC ADD */
 /*

  Modified: lib/ts/ts_expr_node.c (+4 -2)
===================================================================
--- lib/ts/ts_expr_node.c    2015-11-15 14:28:15 +0900 (4ae5d00)
+++ lib/ts/ts_expr_node.c    2015-11-15 14:31:41 +0900 (1252c0a)
@@ -1051,7 +1051,8 @@ grn_ts_op_division_int_int(grn_ctx *ctx, grn_ts_int lhs, grn_ts_int rhs,
 {
   if (!rhs) {
     GRN_TS_ERR_RETURN(GRN_INVALID_ARGUMENT,
-                      "%ld / %ld causes division by zero",
+                      "%" GRN_FMT_INT64 " / %" GRN_FMT_INT64
+                      " causes division by zero",
                       lhs, rhs);
   }
   *out = (rhs != -1) ? (lhs / rhs) : -lhs;
@@ -1075,7 +1076,8 @@ grn_ts_op_modulus_int_int(grn_ctx *ctx, grn_ts_int lhs, grn_ts_int rhs,
 {
   if (!rhs) {
     GRN_TS_ERR_RETURN(GRN_INVALID_ARGUMENT,
-                      "%ld %% %ld causes division by zero",
+                      "%" GRN_FMT_INT64 " %% %" GRN_FMT_INT64
+                      " causes division by zero",
                       lhs, rhs);
   }
   *out = (rhs != -1) ? (lhs % rhs) : -lhs;
-------------- next part --------------
HTML����������������������������...
Download 



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