]> granicus.if.org Git - graphviz/commitdiff
Replace _sys_stat with HAVE_SYS_STAT_H
authorErwin Janssen <erwinjanssen@outlook.com>
Fri, 2 Jun 2017 21:47:13 +0000 (23:47 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Thu, 13 Jul 2017 10:52:45 +0000 (12:52 +0200)
The check for <sys/stat.h> is already included in configure.ac, so
this could be used instead of the check in features/sfio.

lib/sfio/features/sfio
lib/sfio/sfhdr.h
lib/sfio/sfsetbuf.c
lib/sfio/sfsize.c
windows/include/FEATURE/sfio

index 7b1339ca2cee3ed8806cca4fad8407eee9a7de35..8ff2dca73f78e84a781c05658c5443637e15a4f6 100644 (file)
@@ -26,20 +26,6 @@ exit    cleanup note{ stuck with standard _cleanup }end execute{
         main() { printf("cleanup\n"); exit(1); }
 }end
 
-sys stat note{ stat() in default lib(s) }end link{
-       #if _STD_
-       #include        <stddef.h>
-       #else
-       #include        <sys/types.h>
-       #endif
-       #include        <time.h>
-       #include        <sys/stat.h>
-       main()
-       {       struct stat     st;
-               fstat(0,&st);
-       }
-}end
-
 hdr stat note{ stat() in default lib(s) }end link{
        #if _STD_
        #include        <stddef.h>
index a48c380dbc63ffb1bf7181a80fb73648708db9b9..9d47edf98b91ac29ce549034a2b68df80aa2cb44 100644 (file)
@@ -50,7 +50,7 @@ extern "C" {
    are not needed and they may get in the way so we remove them here.
 */
 #if defined(_SFBINARY_H)
-#undef  _sys_stat
+#undef  HAVE_SYS_ST
 #undef  _hdr_stat
 #undef  _lib_poll
 #undef  _stream_peek
@@ -66,19 +66,19 @@ extern "C" {
 #include       <stdint.h>
 #include       <stddef.h>
 
-#if _sys_stat
+#if HAVE_SYS_STAT_H
 #include       <sys/stat.h>
 #else
 #if _hdr_stat
 #include       <stat.h>
-#ifndef _sys_stat
-#define        _sys_stat       1
+#ifndef HAVE_SYS_STAT_H
+#define        HAVE_SYS_STAT_H 1
 #endif
 #endif
-#endif /*_sys_stat*/
+#endif /*HAVE_SYS_STAT_H*/
 
-#ifndef _sys_stat
-#define _sys_stat      0
+#ifndef HAVE_SYS_STAT_H
+#define HAVE_SYS_STAT_H        0
 #endif
 
 #include       <fcntl.h>
@@ -153,7 +153,7 @@ extern "C" {
 #endif
 
 /* 64-bit vs 32-bit file stuff */
-#if _sys_stat
+#if HAVE_SYS_STAT_H
 #ifdef _LARGEFILE64_SOURCE
     typedef struct stat64 Stat_t;
 #define        lseek           lseek64
@@ -823,7 +823,7 @@ extern "C" {
     typedef int (*Onexit_f)(void);
     extern Onexit_f onexit(Onexit_f);
 
-#if _sys_stat
+#if HAVE_SYS_STAT_H
     extern int fstat(int, Stat_t *);
 #endif
 
index 255be54e867b1a8f8654a70d8716ceebe9ec0691..f706df24863bd32ea0cb7ac8e2335b0bd8889b93 100644 (file)
@@ -41,13 +41,13 @@ extern "C" {
 **
 **     Written by Kiem-Phong Vo.
 */
-#if !_sys_stat
+#if !HAVE_SYS_STAT_H
     struct stat {
     int st_mode;
     int st_size;
 };
 #define fstat(fd,st)   (-1)
-#endif /*_sys_stat*/
+#endif /*HAVE_SYS_STAT_H*/
 
 /**
  * @param f stream to be buffered
@@ -138,7 +138,7 @@ void *sfsetbuf(reg Sfio_t * f, reg void * buf, reg size_t size)
        st.st_mode = 0;
 
        /* if has discipline, set size by discipline if possible */
-       if (!_sys_stat || disc) {
+       if (!HAVE_SYS_STAT_H || disc) {
            if ((f->here = SFSK(f, (Sfoff_t) 0, SEEK_CUR, disc)) < 0)
                goto unseekable;
            else {
@@ -154,7 +154,7 @@ void *sfsetbuf(reg Sfio_t * f, reg void * buf, reg size_t size)
        if (fstat((int) f->file, &st) < 0)
            f->here = -1;
        else {
-#if _sys_stat && _stat_blksize /* preferred io block size */
+#if HAVE_SYS_STAT_H && _stat_blksize   /* preferred io block size */
            if ((blksize = (ssize_t) st.st_blksize) > 0)
                while ((blksize + (ssize_t) st.st_blksize) <= SF_PAGE)
                    blksize += (ssize_t) st.st_blksize;
@@ -185,7 +185,7 @@ void *sfsetbuf(reg Sfio_t * f, reg void * buf, reg size_t size)
                    /* set line mode for terminals */
                    if (!(f->flags & SF_LINE) && isatty(f->file))
                        f->flags |= SF_LINE;
-#if _sys_stat
+#if HAVE_SYS_STAT_H
                    else {      /* special case /dev/null */
                        reg int dev, ino;
                        dev = (int) st.st_dev;
index a516d0759b7e224f6e485e4e821d427e995b2b9c..4fdacc44a13bdccc93b55c8c866a721fda1b5f48 100644 (file)
@@ -43,14 +43,14 @@ Sfoff_t sfsize(reg Sfio_t * f)
            for (disc = f->disc; disc; disc = disc->disc)
                if (disc->seekf)
                    break;
-           if (!_sys_stat || disc) {
+           if (!HAVE_SYS_STAT_H || disc) {
                Sfoff_t e;
                if ((e = SFSK(f, 0, SEEK_END, disc)) >= 0)
                    f->extent = e;
                if (SFSK(f, f->here, SEEK_SET, disc) != f->here)
                    f->here = SFSK(f, (Sfoff_t) 0, SEEK_CUR, disc);
            }
-#if _sys_stat
+#if HAVE_SYS_STAT_H
            else {
                Stat_t st;
                if (fstat(f->file, &st) < 0)
index 3cd7b3670031f4a4d9cc8b5455fb03e9cf346ca7..738269918e549e1bd4fc3ec0e70becae7b64cf9a 100644 (file)
@@ -4,7 +4,6 @@
 #define _sys_types     1       /* #include <sys/types.h> ok */
 //#define _hdr_unistd  1       /* #include <unistd.h> ok */
 #define _typ_off64_t   1       /* off64_t is a type */
-#define _sys_stat      1       /* stat() in default lib(s) */
 #define _lib_remove    1       /* remove() in default lib(s) */
 #define _lib_getpagesize       0       /* getpagesize() in default lib(s) */
 #define _tmp_rmfail    1       /* file not removable if still opened */