[Pcre-svn] [268] code/trunk: Fix pcre2grep compile with -std…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [268] code/trunk: Fix pcre2grep compile with -std=c99.
Revision: 268
          http://www.exim.org/viewvc/pcre2?view=rev&revision=268
Author:   ph10
Date:     2015-05-16 17:52:45 +0100 (Sat, 16 May 2015)
Log Message:
-----------
Fix pcre2grep compile with -std=c99.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2grep.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-05-16 16:02:46 UTC (rev 267)
+++ code/trunk/ChangeLog    2015-05-16 16:52:45 UTC (rev 268)
@@ -126,7 +126,10 @@
 31. Fix -fsanitize=undefined warnings for left shifts of 1 by 31 (it treats 1 
 as an int; fixed by writing it as 1u).


+32. Fix pcre2grep compile when -std=c99 is used with gcc, though it still gives
+a warning for "fileno" unless -std=gnu99 us used.

+
Version 10.10 06-March-2015
---------------------------


Modified: code/trunk/src/pcre2grep.c
===================================================================
--- code/trunk/src/pcre2grep.c    2015-05-16 16:02:46 UTC (rev 267)
+++ code/trunk/src/pcre2grep.c    2015-05-16 16:52:45 UTC (rev 268)
@@ -581,7 +581,7 @@
 struct stat statbuf;
 if (stat(filename, &statbuf) < 0)
   return 0;        /* In the expectation that opening as a file will fail */
-return (statbuf.st_mode & S_IFMT) == S_IFDIR;
+return S_ISDIR(statbuf.st_mode);
 }


 static directory_type *
@@ -618,7 +618,7 @@
 struct stat statbuf;
 if (stat(filename, &statbuf) < 0)
   return 1;        /* In the expectation that opening as a file will fail */
-return (statbuf.st_mode & S_IFMT) == S_IFREG;
+return S_ISREG(statbuf.st_mode);
 }