diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2023-04-15 14:07:01 +0200 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2023-04-15 14:28:29 +0200 |
commit | 57fb9abd4355fae4b923403f4bcf51013d16e2c2 (patch) | |
tree | bd672d22d3236a2a51a09dc141f6680c74063cea /src | |
parent | fac2c16d1237fdeccb4017268f3068254cbde573 (diff) | |
download | fork-ledger-57fb9abd4355fae4b923403f4bcf51013d16e2c2.tar.gz fork-ledger-57fb9abd4355fae4b923403f4bcf51013d16e2c2.tar.bz2 fork-ledger-57fb9abd4355fae4b923403f4bcf51013d16e2c2.zip |
Use #cmakedefine01 for system capability checks
and reply #ifdev HAVE_ with #if HAVE_
Diffstat (limited to 'src')
-rw-r--r-- | src/history.cc | 4 | ||||
-rw-r--r-- | src/main.cc | 6 | ||||
-rw-r--r-- | src/report.cc | 6 | ||||
-rw-r--r-- | src/report.h | 2 | ||||
-rw-r--r-- | src/select.cc | 4 | ||||
-rw-r--r-- | src/system.hh.in | 30 | ||||
-rw-r--r-- | src/textual.cc | 12 | ||||
-rw-r--r-- | src/utils.cc | 6 |
8 files changed, 35 insertions, 35 deletions
diff --git a/src/history.cc b/src/history.cc index 5dc56b89..fb0d320c 100644 --- a/src/history.cc +++ b/src/history.cc @@ -467,7 +467,7 @@ commodity_history_impl_t::find_price(const commodity_t& source, const commodity_t * last_target = ⌖ -#if defined(REVERSE_PREDECESSOR_MAP) +#if REVERSE_PREDECESSOR_MAP typedef tuple<const commodity_t *, const commodity_t *, const price_point_t *> results_tuple; std::vector<results_tuple> results; @@ -494,7 +494,7 @@ commodity_history_impl_t::find_price(const commodity_t& source, const commodity_t * u_comm = get(namemap, u); const commodity_t * v_comm = get(namemap, v); -#if defined(REVERSE_PREDECESSOR_MAP) +#if REVERSE_PREDECESSOR_MAP if (v == tv && u_comm != last_target && v_comm != last_target) results_reversed = true; diff --git a/src/main.cc b/src/main.cc index bc2a1e28..6b3e1eb3 100644 --- a/src/main.cc +++ b/src/main.cc @@ -39,7 +39,7 @@ #include <boost/nowide/args.hpp> #endif -#ifdef HAVE_EDIT +#if HAVE_EDIT #include <editline/readline.h> #endif @@ -137,7 +137,7 @@ int main(int argc, char * argv[], char * envp[]) bool exit_loop = false; -#ifdef HAVE_EDIT +#if HAVE_EDIT rl_readline_name = const_cast<char *>("Ledger"); // TODO: rl_attempted_completion_function = ledger_completion; @@ -178,7 +178,7 @@ int main(int argc, char * argv[], char * envp[]) global_scope->execute_command_wrapper(split_arguments(p), true); } -#ifdef HAVE_EDIT +#if HAVE_EDIT if (expansion) std::free(expansion); std::free(p); diff --git a/src/report.cc b/src/report.cc index 991f3a6d..6c957767 100644 --- a/src/report.cc +++ b/src/report.cc @@ -56,7 +56,7 @@ void report_t::normalize_options(const string& verb) // Patch up some of the reporting options based on what kind of // command it was. -#ifdef HAVE_ISATTY +#if HAVE_ISATTY if (! HANDLED(force_color)) { if (! HANDLED(no_color) && isatty(STDOUT_FILENO)) HANDLER(color).on("?normalize"); @@ -183,14 +183,14 @@ void report_t::normalize_options(const string& verb) } long cols = 0; -#ifdef HAVE_IOCTL +#if HAVE_IOCTL struct winsize ws; #endif if (HANDLED(columns_)) cols = lexical_cast<long>(HANDLER(columns_).value); else if (const char * columns = std::getenv("COLUMNS")) cols = lexical_cast<long>(columns); -#ifdef HAVE_IOCTL +#if HAVE_IOCTL else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) cols = ws.ws_col; #endif diff --git a/src/report.h b/src/report.h index a63360ca..daa9c7c0 100644 --- a/src/report.h +++ b/src/report.h @@ -806,7 +806,7 @@ public: OPTION(report_t, output_); // -o // setenv() is not available on WIN32 -#if defined(HAVE_ISATTY) and !defined(_WIN32) and !defined(__CYGWIN__) +#if HAVE_ISATTY and !defined(_WIN32) and !defined(__CYGWIN__) OPTION__ (report_t, pager_, CTOR(report_t, pager_) { diff --git a/src/select.cc b/src/select.cc index 6660f1ab..ccec34ec 100644 --- a/src/select.cc +++ b/src/select.cc @@ -145,14 +145,14 @@ value_t select_command(call_scope_t& args) string thus_far = ""; std::size_t cols = 0; -#ifdef HAVE_IOCTL +#if HAVE_IOCTL struct winsize ws; #endif if (report.HANDLED(columns_)) cols = lexical_cast<std::size_t>(report.HANDLER(columns_).value); else if (const char * columns_env = std::getenv("COLUMNS")) cols = lexical_cast<std::size_t>(columns_env); -#ifdef HAVE_IOCTL +#if HAVE_IOCTL else if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) cols = ws.ws_col; #endif diff --git a/src/system.hh.in b/src/system.hh.in index e74dc774..35253962 100644 --- a/src/system.hh.in +++ b/src/system.hh.in @@ -55,23 +55,23 @@ #define Ledger_VERSION_PRERELEASE "@Ledger_VERSION_PRERELEASE@" #define Ledger_VERSION_DATE @Ledger_VERSION_DATE@ -#define HAVE_GETTEXT @HAVE_GETTEXT@ +#cmakedefine01 HAVE_GETTEXT -#cmakedefine HAVE_EDIT -#cmakedefine HAVE_GETPWUID -#cmakedefine HAVE_GETPWNAM -#cmakedefine HAVE_IOCTL -#cmakedefine HAVE_ISATTY +#cmakedefine01 HAVE_EDIT +#cmakedefine01 HAVE_GETPWUID +#cmakedefine01 HAVE_GETPWNAM +#cmakedefine01 HAVE_IOCTL +#cmakedefine01 HAVE_ISATTY -#define HAVE_UNIX_PIPES @HAVE_UNIX_PIPES@ +#cmakedefine01 HAVE_UNIX_PIPES -#define HAVE_BOOST_PYTHON @HAVE_BOOST_PYTHON@ -#define HAVE_GPGME @HAVE_GPGME@ -#define HAVE_BOOST_REGEX_UNICODE @HAVE_BOOST_REGEX_UNICODE@ -#define HAVE_BOOST_NOWIDE @HAVE_BOOST_NOWIDE@ +#cmakedefine01 HAVE_BOOST_PYTHON +#cmakedefine01 HAVE_GPGME +#cmakedefine01 HAVE_BOOST_REGEX_UNICODE +#cmakedefine01 HAVE_BOOST_NOWIDE -#define DEBUG_MODE @DEBUG_MODE@ -#define NO_ASSERTS @NO_ASSERTS@ +#cmakedefine01 DEBUG_MODE +#cmakedefine01 NO_ASSERTS #define DOCUMENT_MODEL 0 #define REDUCE_TO_INTEGER 0 @@ -113,11 +113,11 @@ #else #include <unistd.h> #endif -#if defined(HAVE_GETPWUID) || defined(HAVE_GETPWNAM) +#if HAVE_GETPWUID || HAVE_GETPWNAM #include <pwd.h> #endif -#ifdef HAVE_IOCTL +#if HAVE_IOCTL #include <sys/ioctl.h> #endif diff --git a/src/textual.cc b/src/textual.cc index 38142119..2da123a7 100644 --- a/src/textual.cc +++ b/src/textual.cc @@ -46,7 +46,7 @@ #endif #define TIMELOG_SUPPORT 1 -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT #include "timelog.h" #endif @@ -79,7 +79,7 @@ namespace { instance_t * parent; std::list<application_t> apply_stack; bool no_assertions; -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT time_log_t timelog; #endif @@ -138,7 +138,7 @@ namespace { void read_next_directive(bool& error_flag); -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT void clock_in_directive(char * line, bool capitalized); void clock_out_directive(char * line, bool capitalized); #endif @@ -295,7 +295,7 @@ void instance_t::parse() apply_stack.pop_front(); -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT timelog.close(); #endif // TIMELOG_SUPPORT @@ -405,7 +405,7 @@ void instance_t::read_next_directive(bool& error_flag) default: // some other directive if (! general_directive(line)) { switch (line[0]) { -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT case 'i': clock_in_directive(line, false); break; @@ -451,7 +451,7 @@ void instance_t::read_next_directive(bool& error_flag) } } -#if defined(TIMELOG_SUPPORT) +#if TIMELOG_SUPPORT void instance_t::clock_in_directive(char * line, bool capitalized) { diff --git a/src/utils.cc b/src/utils.cc index baf5a27a..955b5a7f 100644 --- a/src/utils.cc +++ b/src/utils.cc @@ -662,7 +662,7 @@ static struct __maybe_enable_debugging { * Timers (allows log xacts to specify cumulative time spent) */ -#if LOGGING_ON && defined(TIMERS_ON) +#if LOGGING_ON && TIMERS_ON namespace ledger { @@ -807,7 +807,7 @@ path expand_path(const path& pathname) if (path_string.length() == 1 || pos == 1) { pfx = std::getenv("HOME"); -#ifdef HAVE_GETPWUID +#if HAVE_GETPWUID if (! pfx) { // Punt. We're trying to expand ~/, but HOME isn't set struct passwd * pw = getpwuid(getuid()); @@ -816,7 +816,7 @@ path expand_path(const path& pathname) } #endif } -#ifdef HAVE_GETPWNAM +#if HAVE_GETPWNAM else { string user(path_string, 1, pos == string::npos ? string::npos : pos - 1); |