1
0
Fork 0
forked from poz/modfetch

++ -> += 1 outside all loops to improve readability

I like it better now
This commit is contained in:
jacekpoz 2024-02-09 15:11:36 +01:00
parent 21aefd281a
commit 36b59a2e29
No known key found for this signature in database
GPG key ID: 94E812A8B12AAE3C

View file

@ -52,12 +52,12 @@ char *remove_whitespaces(const char *str) {
size_t j = 0; size_t j = 0;
while (str[i] != '\0') { while (str[i] != '\0') {
if (isspace(str[i])) { if (isspace(str[i])) {
++i; i += 1;
continue; continue;
} }
tmp[j] = str[i]; tmp[j] = str[i];
++i; i += 1;
++j; j += 1;
} }
tmp[j] = '\0'; tmp[j] = '\0';
@ -102,12 +102,12 @@ char *resolve_env_vars(const char *str) {
if (in_env_var) { if (in_env_var) {
env_var[env_var_offset] = str[i]; env_var[env_var_offset] = str[i];
++env_var_offset; env_var_offset += 1;
continue; continue;
} }
ret[ret_offset] = str[i]; ret[ret_offset] = str[i];
++ret_offset; ret_offset += 1;
} }
return ret; return ret;
@ -174,7 +174,7 @@ Config parse_config(FILE *config_file) {
} }
current_module.config[config_index] = NULL; current_module.config[config_index] = NULL;
config.modules[config.module_count] = current_module; config.modules[config.module_count] = current_module;
++config.module_count; config.module_count += 1;
config_index = 0; config_index = 0;
continue; 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 = realloc(current_module.config, INITIAL_CONFIG_SIZE * config_multiplier);
} }
current_module.config[config_index] = process_str(line); current_module.config[config_index] = process_str(line);
++config_index; config_index += 1;
continue; continue;
} }
@ -196,7 +196,7 @@ Config parse_config(FILE *config_file) {
current_module.config[0] = NULL; current_module.config[0] = NULL;
config.modules[config.module_count] = current_module; config.modules[config.module_count] = current_module;
++config.module_count; config.module_count += 1;
free(line); free(line);
} }
@ -220,7 +220,7 @@ int main(int argc, char *argv[]) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
++i; i += 1;
config_path = argv[i]; config_path = argv[i];
continue; continue;
} }