[Groonga-commit] groonga/groonga at c6d9fc7 [master] Add GRN_FMT_SOCKET to suppress warnings

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Oct 28 17:21:33 JST 2014


Kouhei Sutou	2014-10-28 17:21:33 +0900 (Tue, 28 Oct 2014)

  New Revision: c6d9fc79237e81f6d827156c96b1262fdaf0eb56
  https://github.com/groonga/groonga/commit/c6d9fc79237e81f6d827156c96b1262fdaf0eb56

  Message:
    Add GRN_FMT_SOCKET to suppress warnings

  Modified files:
    lib/com.c
    lib/groonga_in.h

  Modified: lib/com.c (+10 -4)
===================================================================
--- lib/com.c    2014-10-28 17:12:24 +0900 (14c9005)
+++ lib/com.c    2014-10-28 17:21:33 +0900 (01c291a)
@@ -387,7 +387,10 @@ grn_com_event_mod(grn_ctx *ctx, grn_com_event *ev, grn_sock fd, int events, grn_
   if (!ev) { return GRN_INVALID_ARGUMENT; }
   if (grn_hash_get(ctx, ev->hash, &fd, sizeof(grn_sock), (void **)&c)) {
     if (c->fd != fd) {
-      GRN_LOG(ctx, GRN_LOG_ERROR, "grn_com_event_mod fd unmatch %d != %d", c->fd, fd);
+      GRN_LOG(ctx, GRN_LOG_ERROR,
+              "grn_com_event_mod fd unmatch "
+              "%" GRN_FMT_SOCKET " != %" GRN_FMT_SOCKET,
+              c->fd, fd);
       return GRN_OBJECT_CORRUPT;
     }
     if (com) { *com = c; }
@@ -449,7 +452,9 @@ grn_com_event_del(grn_ctx *ctx, grn_com_event *ev, grn_sock fd)
 #endif /* USE_KQUEUE */
       return grn_hash_delete_by_id(ctx, ev->hash, id, NULL);
     } else {
-      GRN_LOG(ctx, GRN_LOG_ERROR, "%04x| fd(%d) not found in ev(%p)", getpid(), fd, ev);
+      GRN_LOG(ctx, GRN_LOG_ERROR,
+              "%04x| fd(%" GRN_FMT_SOCKET ") not found in ev(%p)",
+              getpid(), fd, ev);
       return GRN_INVALID_ARGUMENT;
     }
   }
@@ -739,7 +744,8 @@ grn_com_send(grn_ctx *ctx, grn_com *cs,
     }
   }
   if (ret != whole_size) {
-    GRN_LOG(ctx, GRN_LOG_ERROR, "sendmsg(%d): %" GRN_FMT_LLD " < %" GRN_FMT_LLU,
+    GRN_LOG(ctx, GRN_LOG_ERROR,
+            "sendmsg(%" GRN_FMT_SOCKET "): %" GRN_FMT_LLD " < %" GRN_FMT_LLU,
             cs->fd, (long long int)ret, (unsigned long long int)whole_size);
     rc = ctx->rc;
   }
@@ -832,7 +838,7 @@ grn_com_recv(grn_ctx *ctx, grn_com *com, grn_com_header *header, grn_obj *buf)
   do {
     if ((ret = recv(com->fd, p, rest, 0)) < 0) {
       SERR("recv size");
-      GRN_LOG(ctx, GRN_LOG_ERROR, "recv error (%d)", com->fd);
+      GRN_LOG(ctx, GRN_LOG_ERROR, "recv error (%" GRN_FMT_SOCKET ")", com->fd);
       if (ctx->rc == GRN_OPERATION_WOULD_BLOCK ||
           ctx->rc == GRN_INTERRUPTED_FUNCTION_CALL) {
         ERRCLR(ctx);

  Modified: lib/groonga_in.h (+2 -0)
===================================================================
--- lib/groonga_in.h    2014-10-28 17:12:24 +0900 (8fb18e3)
+++ lib/groonga_in.h    2014-10-28 17:21:33 +0900 (0c22b27)
@@ -453,11 +453,13 @@ typedef int grn_cond;
 # define GRN_FMT_LLU "I64u"
 # define GRN_FMT_SIZE  "Iu"
 # define GRN_FMT_SSIZE "Id"
+# define GRN_FMT_SOCKET GRN_FMT_INT64U
 #else /* WIN32 */
 # define GRN_FMT_LLD  "lld"
 # define GRN_FMT_LLU  "llu"
 # define GRN_FMT_SIZE  "zu"
 # define GRN_FMT_SSIZE "zd"
+# define GRN_FMT_SOCKET "d"
 #endif /* WIN32 */
 
 #ifdef __GNUC__
-------------- next part --------------
HTML����������������������������...
Download 



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