From 36b59a2e29804d62e588239a4b69de93517aa139 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Fri, 9 Feb 2024 15:11:36 +0100 Subject: [PATCH] `++` -> `+= 1` outside all loops to improve readability I like it better now --- modfetch.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/modfetch.c b/modfetch.c index fdcccaa..8d7f2ad 100644 --- a/modfetch.c +++ b/modfetch.c @@ -52,12 +52,12 @@ char *remove_whitespaces(const char *str) { size_t j = 0; while (str[i] != '\0') { if (isspace(str[i])) { - ++i; + i += 1; continue; } tmp[j] = str[i]; - ++i; - ++j; + i += 1; + j += 1; } tmp[j] = '\0'; @@ -102,12 +102,12 @@ char *resolve_env_vars(const char *str) { if (in_env_var) { env_var[env_var_offset] = str[i]; - ++env_var_offset; + env_var_offset += 1; continue; } ret[ret_offset] = str[i]; - ++ret_offset; + ret_offset += 1; } return ret; @@ -174,7 +174,7 @@ Config parse_config(FILE *config_file) { } current_module.config[config_index] = NULL; config.modules[config.module_count] = current_module; - ++config.module_count; + config.module_count += 1; config_index = 0; continue; } @@ -185,7 +185,7 @@ Config parse_config(FILE *config_file) { current_module.config = realloc(current_module.config, INITIAL_CONFIG_SIZE * config_multiplier); } current_module.config[config_index] = process_str(line); - ++config_index; + config_index += 1; continue; } @@ -196,7 +196,7 @@ Config parse_config(FILE *config_file) { current_module.config[0] = NULL; config.modules[config.module_count] = current_module; - ++config.module_count; + config.module_count += 1; free(line); } @@ -220,7 +220,7 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); } - ++i; + i += 1; config_path = argv[i]; continue; }