Ticket #1642: ifdef.patch

File ifdef.patch, 2.6 KB (added by sfionov, 9 years ago)
  • src/filegui.c

    From cc0187c5fd4ee5513702d4aa5b3b16d39fcc3188 Mon Sep 17 00:00:00 2001
    From: Sergey Fionov <fionov@gmail.com>
    Date: Mon, 26 Oct 2009 21:56:13 +0300
    Subject: [PATCH 7/7] Ticket #1642
    
    Replace if macros by ifdef
    ---
     src/filegui.c |   24 ++++++++++++------------
     1 files changed, 12 insertions(+), 12 deletions(-)
    
    diff --git a/src/filegui.c b/src/filegui.c
    index 50275c4..9e83ba1 100644
    a b  
    5555#include <sys/types.h> 
    5656#include <sys/stat.h> 
    5757 
    58 #if (STAT_STATVFS \ 
    59      && (HAVE_STRUCT_STATVFS_F_BASETYPE || HAVE_STRUCT_STATVFS_F_FSTYPENAME)) 
    60 #   define USE_STATVFS 1 
     58#if defined(STAT_STATVFS) \ 
     59     && (defined(HAVE_STRUCT_STATVFS_F_BASETYPE) \ 
     60         || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)) 
    6161#   include <sys/statvfs.h> 
    6262#   define STRUCT_STATFS struct statvfs 
    6363#   define STATFS statvfs 
    64 #elif HAVE_STATFS && !STAT_STATFS4 
    65 #   define USE_STATFS 1 
    66 #   if HAVE_SYS_VFS_H 
     64#elif defined(HAVE_STATFS) && !defined(STAT_STATFS4) 
     65#   ifdef HAVE_SYS_VFS_H 
    6766#      include <sys/vfs.h> 
    68 #   elif HAVE_SYS_MOUNT_H && HAVE_SYS_PARAM_H 
     67#   elif defined(HAVE_SYS_MOUNT_H) && defined(HAVE_SYS_PARAM_H) 
    6968#      include <sys/param.h> 
    7069#      include <sys/mount.h> 
    71 #   elif HAVE_SYS_STATFS_H 
     70#   elif defined(HAVE_SYS_STATFS_H) 
    7271#      include <sys/statfs.h> 
    7372#   endif 
    7473#   define STRUCT_STATFS struct statfs 
    enum { 
    169168static int 
    170169filegui__check_attrs_on_fs(const char *fs_path) 
    171170{ 
    172 #if USE_STATFS || USE_STATVFS 
     171#ifdef STATFS 
    173172    STRUCT_STATFS stfs; 
    174173 
    175174    if (STATFS(fs_path, &stfs)!=0) 
    filegui__check_attrs_on_fs(const char *fs_path) 
    188187        return 0; 
    189188        break; 
    190189    } 
    191 # elif HAVE_STRUCT_STATFS_F_FSTYPENAME || HAVE_STRUCT_STATVFS_F_FSTYPENAME 
     190# elif defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) \ 
     191      || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME) 
    192192    if (!strcmp(stfs.f_fstypename, "msdos") 
    193193        || !strcmp(stfs.f_fstypename, "msdosfs") 
    194194        || !strcmp(stfs.f_fstypename, "ntfs") 
    filegui__check_attrs_on_fs(const char *fs_path) 
    196196        || !strcmp(stfs.f_fstypename, "smbfs") 
    197197        || strstr(stfs.f_fstypename, "fusefs")) 
    198198        return 0; 
    199 # elif HAVE_STRUCT_STATVFS_F_BASETYPE 
     199# elif defined(HAVE_STRUCT_STATVFS_F_BASETYPE) 
    200200    if (!strcmp(stfs.f_basetype, "pcfs") 
    201201        || !strcmp(stfs.f_basetype, "ntfs") 
    202202        || !strcmp(stfs.f_basetype, "proc") 
    filegui__check_attrs_on_fs(const char *fs_path) 
    204204        || !strcmp(stfs.f_basetype, "fuse")) 
    205205        return 0; 
    206206# endif 
    207 #endif /* USE_STATFS || USE_STATVFS */ 
     207#endif /* STATFS */ 
    208208 
    209209    return 1; 
    210210}