[Groonga-commit] groonga/groonga at 1ed7c72 [master] Add grn_fileno for portability

Back to archive index

Susumu Yata null+****@clear*****
Fri Aug 18 17:42:15 JST 2017


Susumu Yata	2017-08-18 17:42:15 +0900 (Fri, 18 Aug 2017)

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

  Message:
    Add grn_fileno for portability

  Modified files:
    include/groonga/portability.h
    lib/logger.c

  Modified: include/groonga/portability.h (+7 -1)
===================================================================
--- include/groonga/portability.h    2017-08-16 10:44:57 +0900 (801aa4832)
+++ include/groonga/portability.h    2017-08-18 17:42:15 +0900 (4a888af88)
@@ -1,5 +1,5 @@
 /*
-  Copyright(C) 2015-2016 Brazil
+  Copyright(C) 2015-2017 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -181,3 +181,9 @@
 #else /* WIN32 */
 # define grn_close(fd) close((fd))
 #endif /* WIN32 */
+
+#ifdef WIN32
+# define grn_fileno(stream) _fileno((stream))
+#else /* WIN32 */
+# define grn_fileno(stream) fileno((stream))
+#endif /* WIN32 */

  Modified: lib/logger.c (+2 -6)
===================================================================
--- lib/logger.c    2017-08-16 10:44:57 +0900 (449de2366)
+++ lib/logger.c    2017-08-18 17:42:15 +0900 (de8f8530b)
@@ -28,10 +28,6 @@
 # include <share.h>
 #endif /* WIN32 */
 
-#ifdef WIN32
-# define fileno(file) _fileno(file)
-#endif
-
 static const char *log_level_names[] = {
   "none",
   "emergency",
@@ -150,7 +146,7 @@ default_logger_log(grn_ctx *ctx, grn_log_level level,
       default_logger_size = 0;
       if (default_logger_file) {
         struct stat stat;
-        if (fstat(fileno(default_logger_file), &stat) != -1) {
+        if (fstat(grn_fileno(default_logger_file), &stat) != -1) {
           default_logger_size = stat.st_size;
         }
       }
@@ -539,7 +535,7 @@ default_query_logger_log(grn_ctx *ctx, unsigned int flag,
       default_query_logger_size = 0;
       if (default_query_logger_file) {
         struct stat stat;
-        if (fstat(fileno(default_query_logger_file), &stat) != -1) {
+        if (fstat(grn_fileno(default_query_logger_file), &stat) != -1) {
           default_query_logger_size = stat.st_size;
         }
       }
-------------- next part --------------
HTML����������������������������...
Télécharger 



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