]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- con't include config.h in header files
authorArvin Schnell <aschnell@suse.de>
Mon, 15 Jul 2013 15:15:16 +0000 (17:15 +0200)
committerArvin Schnell <aschnell@suse.de>
Mon, 15 Jul 2013 15:15:16 +0000 (17:15 +0200)
12 files changed:
snapper/Compare.cc
snapper/Compare.h
snapper/Comparison.cc
snapper/Comparison.h
snapper/Exception.h
snapper/File.cc
snapper/File.h
snapper/FileUtils.cc
snapper/FileUtils.h
snapper/Makefile.am
snapper/XAttributes.cc
snapper/XAttributes.h

index 29c66b74cffeb66c42df2d5b76ce154f30575436..9b62baabcac3214e2707c8d9a73ecdbf0da27ed3 100644 (file)
@@ -20,6 +20,8 @@
  */
 
 
+#include "config.h"
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <algorithm>
 #include <boost/thread.hpp>
 
-#include "config.h"
 #include "snapper/Log.h"
 #include "snapper/AppUtil.h"
 #include "snapper/File.h"
 #include "snapper/Compare.h"
 #include "snapper/Exception.h"
-
-
-#ifdef ENABLE_XATTRS
-    #include "snapper/XAttributes.h"
-#endif
+#include "snapper/XAttributes.h"
 
 
 namespace snapper
@@ -223,13 +220,13 @@ namespace snapper
        }
 
 #ifdef ENABLE_XATTRS
-            if (file1.xaSupported() && file2.xaSupported())
-            {
-                if (!cmpFilesXattrs(file1, file2))
-                {
-                    status |= XATTRS;
-                }
-            }
+       if (file1.xaSupported() && file2.xaSupported())
+       {
+           if (!cmpFilesXattrs(file1, file2))
+           {
+               status |= XATTRS;
+           }
+       }
 #endif
 
        return status;
@@ -470,8 +467,6 @@ namespace snapper
     }
 
 
-#ifdef ENABLE_XATTRS
-
     bool
     cmpFilesXattrs(const SFile& file1, const SFile& file2)
     {
@@ -488,6 +483,4 @@ namespace snapper
        }
     }
 
-#endif
-
 }
index b88c430216b7ce385d2cbd568f2b4de3e77213b8..2975280cf3700bc8b06b69219bdf7e29b1e985bd 100644 (file)
@@ -48,10 +48,9 @@ namespace snapper
     void
     cmpDirs(const SDir& dir1, const SDir& dir2, cmpdirs_cb_t cb);
 
-#ifdef ENABLE_XATTRS
     bool
     cmpFilesXattrs(const SFile&, const SFile&);
-#endif
+
 }
 
 
index 100e967ae2470e2ee5ed52edf7732e246e6082b1..c1204636361a9333298bce531903b0e1b3de5170 100644 (file)
  */
 
 
+#include "config.h"
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <string.h>
 #include <errno.h>
 
-#include "config.h"
 #include "snapper/Comparison.h"
 #include "snapper/Snapper.h"
 #include "snapper/Log.h"
@@ -259,7 +260,7 @@ namespace snapper
        return files.getUndoStatistic();
     }
 
-#ifdef ENABLE_XATTRS
+
     XAUndoStatistic
     Comparison::getXAUndoStatistic() const
     {
@@ -268,7 +269,6 @@ namespace snapper
 
         return files.getXAUndoStatistic();
     }
-#endif
 
 
     vector<UndoStep>
index c0884c44ed32b3f0911f38709573337c1276cdc2..a99a84179fe2082f5c0e847ad80c9332b9a80637 100644 (file)
@@ -50,9 +50,7 @@ namespace snapper
        void umount() const;
 
        UndoStatistic getUndoStatistic() const;
-#ifdef ENABLE_XATTRS
         XAUndoStatistic getXAUndoStatistic() const;
-#endif
 
        vector<UndoStep> getUndoSteps() const;
 
index 39730359dc554b3370448e3baa8e9b7e4c2a246e..5deadd996a766f2b6c36eef20bab9ebc7270d074 100644 (file)
@@ -75,13 +75,12 @@ namespace snapper
        const char* msg;
     };
 
-#ifdef ENABLE_XATTRS
     struct XAttributesException : public SnapperException
     {
-        explicit XAttributesException() throw() {}
-        virtual const char* what() const throw() { return "XAttributes error"; }
+       explicit XAttributesException() throw() {}
+       virtual const char* what() const throw() { return "XAttributes error"; }
     };
-#endif
+
 }
 
 
index 0f26d7db24b83f2ff4ab6bf7d076ce7cfc690867..bc40ba01ff7b2975c102e0b3b4374a07db2e1a20 100644 (file)
@@ -20,6 +20,8 @@
  */
 
 
+#include "config.h"
+
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <string.h>
@@ -29,7 +31,6 @@
 #include <fcntl.h>
 #include <boost/algorithm/string.hpp>
 
-#include "config.h"
 #include "snapper/File.h"
 #include "snapper/Snapper.h"
 #include "snapper/AppUtil.h"
 #include "snapper/SnapperDefines.h"
 #include "snapper/Compare.h"
 #include "snapper/Exception.h"
+#include "snapper/XAttributes.h"
 
-#ifdef ENABLE_XATTRS
-#include <snapper/XAttributes.h>
-#endif
 
 namespace snapper
 {
@@ -528,7 +527,7 @@ namespace snapper
        return true;
     }
 
-#ifdef ENABLE_XATTRS
+
     bool
     File::modifyXattributes()
     {
@@ -593,7 +592,7 @@ namespace snapper
 
         return xs;
     }
-#endif
+
 
     bool
     File::doUndo()
@@ -630,6 +629,7 @@ namespace snapper
                 error = true;
         }
 #endif
+
        pre_to_system_status = (unsigned int) -1;
        post_to_system_status = (unsigned int) -1;
 
index 7473297542cb30a17950c1cb408323054bb04f72..19c3dc41f015d445803972e16187ac63022e33e6 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef SNAPPER_FILE_H
 #define SNAPPER_FILE_H
 
-#include "config.h"
+
 #include <sys/stat.h>
 
 #include <string>
@@ -71,7 +71,7 @@ namespace snapper
        friend std::ostream& operator<<(std::ostream& s, const UndoStatistic& rs);
     };
 
-#ifdef ENABLE_XATTRS
+
     struct XAUndoStatistic
     {
         XAUndoStatistic(): numCreate(0), numReplace(0), numDelete(0) {}
@@ -82,7 +82,6 @@ namespace snapper
 
         friend XAUndoStatistic& operator+=(XAUndoStatistic&, const XAUndoStatistic&);
     };
-#endif
 
 
     struct UndoStep
@@ -109,10 +108,8 @@ namespace snapper
 
        File(const FilePaths* file_paths, const string& name, unsigned int pre_to_post_status)
            : file_paths(file_paths), name(name), pre_to_post_status(pre_to_post_status),
-             pre_to_system_status(-1), post_to_system_status(-1), undo(false)
-#ifdef ENABLE_XATTRS
-              ,xaCreated(0), xaDeleted(0), xaReplaced(0)
-#endif
+             pre_to_system_status(-1), post_to_system_status(-1), undo(false),
+             xaCreated(0), xaDeleted(0), xaReplaced(0)
        {}
 
        const string& getName() const { return name; }
@@ -133,9 +130,8 @@ namespace snapper
 
        friend std::ostream& operator<<(std::ostream& s, const File& file);
 
-#ifdef ENABLE_XATTRS
-            XAUndoStatistic getXAUndoStatistic() const;
-#endif
+       XAUndoStatistic getXAUndoStatistic() const;
+
     private:
 
        bool createParentDirectories(const string& path) const;
@@ -159,13 +155,12 @@ namespace snapper
 
        bool undo;
 
-#ifdef ENABLE_XATTRS
-            bool modifyXattributes();
+       bool modifyXattributes();
+
+       unsigned int xaCreated;
+       unsigned int xaDeleted;
+       unsigned int xaReplaced;
 
-            unsigned int xaCreated;
-            unsigned int xaDeleted;
-            unsigned int xaReplaced;
-#endif
     };
 
 
@@ -202,9 +197,9 @@ namespace snapper
        vector<UndoStep> getUndoSteps() const;
 
        bool doUndoStep(const UndoStep& undo_step);
-#ifdef ENABLE_XATTRS
+
         XAUndoStatistic getXAUndoStatistic() const;
-#endif
+
     protected:
 
        void push_back(File file) { entries.push_back(file); }
index fa30a774baa642f82160e3a275b21f24b447f8d2..f693ede570790b24ccbd7fa2ed44f7b54c360d79 100644 (file)
  */
 
 
+#include "config.h"
+
 #include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/mount.h>
+#include <sys/xattr.h>
 #include <fcntl.h>
 #include <stddef.h>
 #include <dirent.h>
 #include <assert.h>
 #include <algorithm>
 
-#include "config.h"
-#ifdef ENABLE_XATTRS
-    #include <sys/xattr.h>
-#endif
 #include "snapper/FileUtils.h"
 #include "snapper/AppUtil.h"
 #include "snapper/Log.h"
@@ -69,9 +68,7 @@ namespace snapper
            throw IOErrorException();
        }
 
-#ifdef ENABLE_XATTRS
        setXaStatus();
-#endif
     }
 
 
@@ -97,9 +94,7 @@ namespace snapper
            throw IOErrorException();
        }
 
-#ifdef ENABLE_XATTRS
        xastatus = dir.xastatus;
-#endif
     }
 
 
@@ -113,9 +108,7 @@ namespace snapper
            throw IOErrorException();
        }
 
-#ifdef ENABLE_XATTRS
        xastatus = dir.xastatus;
-#endif
     }
 
 
@@ -132,9 +125,7 @@ namespace snapper
                throw IOErrorException();
            }
 
-#ifdef ENABLE_XATTRS
            xastatus = dir.xastatus;
-#endif
        }
 
        return *this;
@@ -399,8 +390,6 @@ namespace snapper
     }
 
 
-#ifdef ENABLE_XATTRS
-
     bool
     SDir::xaSupported() const
     {
@@ -485,6 +474,7 @@ namespace snapper
     {
        xastatus = XA_UNKNOWN;
 
+#ifdef ENABLE_XATTRS
        ssize_t ret = flistxattr(dirfd, NULL, 0);
        if (ret < 0)
        {
@@ -503,9 +493,8 @@ namespace snapper
        {
            xastatus = XA_SUPPORTED;
        }
-    }
-
 #endif
+    }
 
 
     bool
@@ -599,8 +588,6 @@ namespace snapper
     }
 
 
-#ifdef ENABLE_XATTRS
-
     bool
     SFile::xaSupported() const
     {
@@ -621,6 +608,4 @@ namespace snapper
        return dir.getxattr(SFile::name, name, value, size);
     }
 
-#endif
-
 }
index eec9adc6150bd5f8bb08e99c0f319322271da5a4..bccf31b0940555aeb9219d260ec6e1e37a8f726f 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef SNAPPER_FILE_UTILS_H
 #define SNAPPER_FILE_UTILS_H
 
-#include "config.h"
 
 #include <string>
 #include <vector>
@@ -36,13 +35,12 @@ namespace snapper
     using std::string;
     using std::vector;
 
-#ifdef ENABLE_XATTRS
+
     enum XaAttrsStatus {
        XA_UNKNOWN,
        XA_UNSUPPORTED,
        XA_SUPPORTED
     };
-#endif
 
 
     /*
@@ -93,12 +91,10 @@ namespace snapper
 
        int mktemp(string& name) const;
 
-#ifdef ENABLE_XATTRS
        bool xaSupported() const;
 
        ssize_t listxattr(const string& path, char* list, size_t size) const;
        ssize_t getxattr(const string& path, const char* name, void* value, size_t size) const;
-#endif
 
        bool mount(const string& device, const string& mount_type, unsigned long mount_flags,
                   const string& mount_data) const;
@@ -106,10 +102,8 @@ namespace snapper
 
     private:
 
-#ifdef ENABLE_XATTRS
        XaAttrsStatus xastatus;
        void setXaStatus();
-#endif
 
        const string base_path;
        const string path;
@@ -133,12 +127,10 @@ namespace snapper
        int open(int flags) const;
        int readlink(string& buf) const;
 
-#ifdef ENABLE_XATTRS
        bool xaSupported() const;
 
        ssize_t listxattr(char* list, size_t size) const;
        ssize_t getxattr(const char* name, void* value, size_t size) const;
-#endif
 
     private:
 
index 83bd5797b333b48edc51e817f1d8869b573bceb4..335d885c20591e50f3c4d0233543e887ffbcf3f4 100644 (file)
@@ -8,10 +8,6 @@ INCLUDES = -I/usr/include/libxml2
 
 lib_LTLIBRARIES = libsnapper.la
 
-if HAVE_XATTRS
-TMP_XA = XAttributes.cc        XAttributes.h
-endif
-
 libsnapper_la_SOURCES =                                        \
        Factory.cc              Factory.h               \
        Snapper.cc              Snapper.h               \
@@ -23,6 +19,7 @@ libsnapper_la_SOURCES =                                       \
        Enum.cc                 Enum.h                  \
        AppUtil.cc              AppUtil.h               \
        FileUtils.cc            FileUtils.h             \
+       XAttributes.cc          XAttributes.h           \
        Log.cc                  Log.h                   \
        Logger.cc               Logger.h                \
        Compare.cc              Compare.h               \
index 3f65c6f4044e97067b671bf879087319a26ac848..756e0a0387e2d5b358a7a43bb5aec7ec55904d0f 100644 (file)
 #include <fcntl.h>
 #include <unistd.h>
 #include <errno.h>
-
 #include <iomanip>
+#include <boost/scoped_array.hpp>
 
 #include "snapper/AppUtil.h"
 #include "snapper/Exception.h"
 #include "snapper/Log.h"
 #include "snapper/XAttributes.h"
 
-#include <boost/scoped_array.hpp>
-
 
 namespace snapper
 {
index c74e000d08a86ba7a451746598185bcf3b096918..70482108fee7005ae28a165eb8db1d6c88711e2d 100644 (file)
@@ -23,7 +23,6 @@
 
 
 #include <stdint.h>
-
 #include <map>
 #include <vector>
 #include <string>