summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Michlmayr <tbm@cyrius.com>2014-05-18 09:51:32 -0400
committerMartin Michlmayr <tbm@cyrius.com>2014-05-18 09:51:32 -0400
commit2cee0fe23f84a1e6ccd7078098df2c5ffbe0378f (patch)
tree4f3c4869a427ca176abd69af801b4a04bc8b5641 /src
parent60fd2b234a4cf95223f58a87f413d37ff2ed5fc7 (diff)
downloadfork-ledger-2cee0fe23f84a1e6ccd7078098df2c5ffbe0378f.tar.gz
fork-ledger-2cee0fe23f84a1e6ccd7078098df2c5ffbe0378f.tar.bz2
fork-ledger-2cee0fe23f84a1e6ccd7078098df2c5ffbe0378f.zip
Cosmetic change - format code consistently
Add a space between if and the opening bracket, between a closing round bracket and the following opening curly bracket, etc.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt20
-rw-r--r--src/format.cc2
-rw-r--r--src/global.cc4
-rw-r--r--src/journal.cc8
-rw-r--r--src/option.h2
-rw-r--r--src/output.cc6
-rw-r--r--src/py_times.cc2
-rw-r--r--src/session.cc6
8 files changed, 25 insertions, 25 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9752b052..aec75c06 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -52,7 +52,7 @@ set(LEDGER_SOURCES
strptime.cc
wcwidth.cc)
-if(HAVE_BOOST_PYTHON)
+if (HAVE_BOOST_PYTHON)
list(APPEND LEDGER_SOURCES
py_account.cc
py_amount.cc
@@ -135,8 +135,8 @@ set(LEDGER_INCLUDES
strptime.h
${PROJECT_BINARY_DIR}/system.hh)
-if(CMAKE_BUILD_TYPE STREQUAL "Debug")
- if((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER MATCHES "cxx"))
+if (CMAKE_BUILD_TYPE STREQUAL "Debug")
+ if ((CMAKE_CXX_COMPILER MATCHES "clang") OR (CMAKE_CXX_COMPILER MATCHES "cxx"))
add_definitions(
-Weverything
-Wno-disabled-macro-expansion
@@ -156,7 +156,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_source_files_properties(
${${_src_list}} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}")
- if(_other_srcs)
+ if (_other_srcs)
set_source_files_properties(
${_other_srcs} PROPERTIES COMPILE_FLAGS "-include ${_header_filename}")
endif()
@@ -164,7 +164,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_args ${CMAKE_CXX_FLAGS})
list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG})
- if(BUILD_LIBRARY)
+ if (BUILD_LIBRARY)
list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
endif()
list(APPEND _args "-std=c++11 ")
@@ -211,7 +211,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set_source_files_properties(
${${_src_list}} PROPERTIES COMPILE_FLAGS "-Winvalid-pch")
- if(_other_srcs)
+ if (_other_srcs)
set_source_files_properties(
${_other_srcs} PROPERTIES COMPILE_FLAGS "-Winvalid-pch")
endif()
@@ -219,7 +219,7 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(_args ${CMAKE_CXX_FLAGS})
list(APPEND _args ${CMAKE_CXX_FLAGS_DEBUG})
- if(BUILD_LIBRARY)
+ if (BUILD_LIBRARY)
list(APPEND _args ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
endif()
list(APPEND _args ${GXX_WARNING_FLAGS})
@@ -253,7 +253,7 @@ add_pch_rule(${PROJECT_BINARY_DIR}/system.hh LEDGER_SOURCES main.cc global.cc)
include(GNUInstallDirs)
-if(BUILD_LIBRARY)
+if (BUILD_LIBRARY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
add_library(libledger SHARED ${LEDGER_SOURCES})
add_ledger_library_dependencies(libledger)
@@ -274,7 +274,7 @@ else()
add_ledger_library_dependencies(ledger)
endif()
-if(USE_PYTHON)
+if (USE_PYTHON)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"from __future__ import print_function
import distutils.sysconfig as s
@@ -284,7 +284,7 @@ print(s.get_python_lib(True, prefix=''))"
CACHE PATH "python module directory (${_TMP_PYTHON_SITE_PACKAGES})")
if (PYTHON_SITE_PACKAGES)
- if(WIN32 AND NOT CYGWIN)
+ if (WIN32 AND NOT CYGWIN)
set(_ledger_python_module_name "ledger.pyd")
elseif(CMAKE_HOST_APPLE)
set(_ledger_python_module_name "ledger.so")
diff --git a/src/format.cc b/src/format.cc
index 9b5e7d93..302c28d6 100644
--- a/src/format.cc
+++ b/src/format.cc
@@ -206,7 +206,7 @@ format_t::element_t * format_t::parse_elements(const string& fmt,
sizeof(format_mapping_t)); i++) {
if (*p == single_letter_mappings[i].letter) {
std::ostringstream expr;
- for (const char * ptr = single_letter_mappings[i].expr; *ptr; ){
+ for (const char * ptr = single_letter_mappings[i].expr; *ptr;) {
if (*ptr == '$') {
const char * beg = ++ptr;
while (*ptr && std::isalpha(*ptr))
diff --git a/src/global.cc b/src/global.cc
index 95e408eb..cc928c1b 100644
--- a/src/global.cc
+++ b/src/global.cc
@@ -142,13 +142,13 @@ void global_scope_t::read_init()
throw_(parse_error, _f("Could not find specified init file %1%") % init_file);
}
} else {
- if (const char * home_var = std::getenv("HOME")){
+ if (const char * home_var = std::getenv("HOME")) {
init_file = (path(home_var) / ".ledgerrc");
} else {
init_file = ("./.ledgerrc");
}
}
- if(exists(init_file)){
+ if (exists(init_file)) {
parse_init(init_file);
}
}
diff --git a/src/journal.cc b/src/journal.cc
index ced96ee9..b11b5c45 100644
--- a/src/journal.cc
+++ b/src/journal.cc
@@ -174,7 +174,7 @@ account_t * journal_t::expand_aliases(string name) {
// prevent infinite excursion. Each alias may only be expanded at most once.
account_t * result = NULL;
- if(no_aliases)
+ if (no_aliases)
return result;
bool keep_expanding = true;
@@ -184,7 +184,7 @@ account_t * journal_t::expand_aliases(string name) {
if (account_aliases.size() > 0) {
accounts_map::const_iterator i = account_aliases.find(name);
if (i != account_aliases.end()) {
- if(std::find(already_seen.begin(), already_seen.end(), name) != already_seen.end()) {
+ if (std::find(already_seen.begin(), already_seen.end(), name) != already_seen.end()) {
throw_(std::runtime_error,
_f("Infinite recursion on alias expansion for %1%")
% name);
@@ -197,11 +197,11 @@ account_t * journal_t::expand_aliases(string name) {
// only check the very first account for alias expansion, in case
// that can be expanded successfully
size_t colon = name.find(':');
- if(colon != string::npos) {
+ if (colon != string::npos) {
string first_account_name = name.substr(0, colon);
accounts_map::const_iterator j = account_aliases.find(first_account_name);
if (j != account_aliases.end()) {
- if(std::find(already_seen.begin(), already_seen.end(), first_account_name) != already_seen.end()) {
+ if (std::find(already_seen.begin(), already_seen.end(), first_account_name) != already_seen.end()) {
throw_(std::runtime_error,
_f("Infinite recursion on alias expansion for %1%")
% first_account_name);
diff --git a/src/option.h b/src/option.h
index 21942436..1ea9457d 100644
--- a/src/option.h
+++ b/src/option.h
@@ -229,7 +229,7 @@ public:
inline bool is_eq(const char * p, const char * n) {
// Test whether p matches n, substituting - in p for _ in n.
for (; *p && *n; p++, n++) {
- if (! (*p == '-' && *n == '_' ) && *p != *n)
+ if (! (*p == '-' && *n == '_') && *p != *n)
return false;
}
// Ignore any trailing underscore
diff --git a/src/output.cc b/src/output.cc
index f8555fe5..ba469ea9 100644
--- a/src/output.cc
+++ b/src/output.cc
@@ -331,10 +331,10 @@ void report_tags::flush()
void report_tags::operator()(post_t& post)
{
- if(post.metadata){
- foreach (const item_t::string_map::value_type& data, *post.metadata){
+ if (post.metadata) {
+ foreach (const item_t::string_map::value_type& data, *post.metadata) {
string tag=data.first;
- if(report.HANDLED(values) && (data.second).first){
+ if (report.HANDLED(values) && (data.second).first) {
tag+=": "+ (data.second).first.get().to_string();
}
std::map<string, std::size_t>::iterator i = tags.find(tag);
diff --git a/src/py_times.cc b/src/py_times.cc
index 44a6f3cd..c210889d 100644
--- a/src/py_times.cc
+++ b/src/py_times.cc
@@ -108,7 +108,7 @@ struct datetime_from_python
static void* convertible(PyObject* obj_ptr)
{
MY_PyDateTime_IMPORT;
- if(PyDateTime_Check(obj_ptr)) return obj_ptr;
+ if (PyDateTime_Check(obj_ptr)) return obj_ptr;
return 0;
}
diff --git a/src/session.cc b/src/session.cc
index ec57eab3..e373eb03 100644
--- a/src/session.cc
+++ b/src/session.cc
@@ -93,13 +93,13 @@ std::size_t session_t::read_data(const string& master_account)
acct = journal->find_account(master_account);
optional<path> price_db_path;
- if (HANDLED(price_db_)){
+ if (HANDLED(price_db_)) {
price_db_path = resolve_path(HANDLER(price_db_).str());
- if (!exists(price_db_path.get())){
+ if (!exists(price_db_path.get())) {
throw_(parse_error, _f("Could not find specified price-db file %1%") % price_db_path);
}
} else {
- if (const char * home_var = std::getenv("HOME")){
+ if (const char * home_var = std::getenv("HOME")) {
price_db_path = (path(home_var) / ".pricedb");
} else {
price_db_path = ("./.ledgerrc");