From: Arvin Schnell Date: Fri, 18 Sep 2020 14:36:10 +0000 (+0200) Subject: - coding style X-Git-Tag: v0.8.14~7^2 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=b02fcc5758524c0010d84ef07e95977bcebcbc8f;p=thirdparty%2Fsnapper.git - coding style --- diff --git a/client/installation-helper.cc b/client/installation-helper.cc index 735755c0..66567b4c 100644 --- a/client/installation-helper.cc +++ b/client/installation-helper.cc @@ -73,9 +73,9 @@ step1(const string& device, const string& description, const string& cleanup, try { - SysconfigFile config(CONFIGTEMPLATEDIR "/" "default"); + SysconfigFile config(CONFIG_TEMPLATE_DIR "/" "default"); - config.setName(tmp_mount.getFullname() + CONFIGSDIR "/" "root"); + config.setName(tmp_mount.getFullname() + CONFIGS_DIR "/" "root"); config.setValue(KEY_SUBVOLUME, "/"); config.setValue(KEY_FSTYPE, "btrfs"); @@ -195,7 +195,7 @@ step4() try { - SysconfigFile sysconfig(SYSCONFIGFILE); + SysconfigFile sysconfig(SYSCONFIG_FILE); sysconfig.setValue("SNAPPER_CONFIGS", { "root" }); } catch (const FileNotFoundException& e) diff --git a/client/utils/Range.h b/client/utils/Range.h index 300a426f..55f5c60a 100644 --- a/client/utils/Range.h +++ b/client/utils/Range.h @@ -20,6 +20,9 @@ */ +#ifndef SNAPPER_RANGE_H +#define SNAPPER_RANGE_H + #include using std::istream; @@ -49,3 +52,6 @@ private: size_t min; size_t max; }; + + +#endif diff --git a/configure.ac b/configure.ac index 0c3b58f4..11912667 100644 --- a/configure.ac +++ b/configure.ac @@ -85,7 +85,7 @@ AC_ARG_WITH([conf], AC_HELP_STRING([--with-conf], [Use a custom sysconfig direct AS_IF([test "x$with_conf" != xno], [SYSCONFIG="${with_conf}"]) -CPPFLAGS="${CPPFLAGS} -DCONFDIR='\"${SYSCONFIG}\"'" +CPPFLAGS="${CPPFLAGS} -DCONF_DIR='\"${SYSCONFIG}\"'" AC_ARG_ENABLE([btrfs], AC_HELP_STRING([--disable-btrfs],[Disable Btrfs internal snapshots support]), diff --git a/snapper/Snapper.cc b/snapper/Snapper.cc index 3366773b..6b9f51a2 100644 --- a/snapper/Snapper.cc +++ b/snapper/Snapper.cc @@ -59,7 +59,7 @@ namespace snapper ConfigInfo::ConfigInfo(const string& config_name, const string& root_prefix) - : SysconfigFile(prepend_root_prefix(root_prefix, CONFIGSDIR "/" + config_name)), + : SysconfigFile(prepend_root_prefix(root_prefix, CONFIGS_DIR "/" + config_name)), config_name(config_name), subvolume("/") { if (!getValue(KEY_SUBVOLUME, subvolume)) @@ -156,7 +156,7 @@ namespace snapper void Snapper::loadIgnorePatterns() { - const list files = glob(FILTERSDIR "/*.txt", GLOB_NOSORT); + const list files = glob(FILTERS_DIR "/*.txt", GLOB_NOSORT); for (list::const_iterator it = files.begin(); it != files.end(); ++it) { try @@ -275,7 +275,7 @@ namespace snapper try { - SysconfigFile sysconfig(prepend_root_prefix(root_prefix, SYSCONFIGFILE)); + SysconfigFile sysconfig(prepend_root_prefix(root_prefix, SYSCONFIG_FILE)); vector config_names; sysconfig.getValue("SNAPPER_CONFIGS", config_names); @@ -333,7 +333,7 @@ namespace snapper } } - if (access(string(CONFIGTEMPLATEDIR "/" + template_name).c_str(), R_OK) != 0) + if (access(string(CONFIG_TEMPLATE_DIR "/" + template_name).c_str(), R_OK) != 0) { SN_THROW(CreateConfigFailedException("cannot access template config")); } @@ -354,7 +354,7 @@ namespace snapper try { - SysconfigFile sysconfig(SYSCONFIGFILE); + SysconfigFile sysconfig(SYSCONFIG_FILE); vector config_names; sysconfig.getValue("SNAPPER_CONFIGS", config_names); if (find(config_names.begin(), config_names.end(), config_name) != config_names.end()) @@ -372,9 +372,9 @@ namespace snapper try { - SysconfigFile config(CONFIGTEMPLATEDIR "/" + template_name); + SysconfigFile config(CONFIG_TEMPLATE_DIR "/" + template_name); - config.setName(CONFIGSDIR "/" + config_name); + config.setName(CONFIGS_DIR "/" + config_name); config.setValue(KEY_SUBVOLUME, subvolume); config.setValue(KEY_FSTYPE, filesystem->fstype()); @@ -392,14 +392,14 @@ namespace snapper { SN_CAUGHT(e); - SysconfigFile sysconfig(SYSCONFIGFILE); + SysconfigFile sysconfig(SYSCONFIG_FILE); vector config_names; sysconfig.getValue("SNAPPER_CONFIGS", config_names); config_names.erase(remove(config_names.begin(), config_names.end(), config_name), config_names.end()); sysconfig.setValue("SNAPPER_CONFIGS", config_names); - SystemCmd cmd(RMBIN " " + quote(CONFIGSDIR "/" + config_name)); + SystemCmd cmd(RMBIN " " + quote(CONFIGS_DIR "/" + config_name)); SN_RETHROW(e); } @@ -449,7 +449,7 @@ namespace snapper SN_THROW(DeleteConfigFailedException("deleting snapshot failed")); } - SystemCmd cmd1(RMBIN " " + quote(CONFIGSDIR "/" + config_name)); + SystemCmd cmd1(RMBIN " " + quote(CONFIGS_DIR "/" + config_name)); if (cmd1.retcode() != 0) { SN_THROW(DeleteConfigFailedException("deleting config-file failed")); @@ -457,7 +457,7 @@ namespace snapper try { - SysconfigFile sysconfig(SYSCONFIGFILE); + SysconfigFile sysconfig(SYSCONFIG_FILE); vector config_names; sysconfig.getValue("SNAPPER_CONFIGS", config_names); config_names.erase(remove(config_names.begin(), config_names.end(), config_name), diff --git a/snapper/SnapperDefines.h b/snapper/SnapperDefines.h index 8490894c..13333121 100644 --- a/snapper/SnapperDefines.h +++ b/snapper/SnapperDefines.h @@ -26,12 +26,12 @@ // path definitions -#define SYSCONFIGFILE CONFDIR "/snapper" +#define SYSCONFIG_FILE CONF_DIR "/snapper" -#define CONFIGSDIR "/etc/snapper/configs" -#define CONFIGTEMPLATEDIR "/etc/snapper/config-templates" +#define CONFIGS_DIR "/etc/snapper/configs" +#define CONFIG_TEMPLATE_DIR "/etc/snapper/config-templates" -#define FILTERSDIR "/etc/snapper/filters" +#define FILTERS_DIR "/etc/snapper/filters" // keys from the config files