summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2017-07-25 13:57:55 -0300
committerGitHub <noreply@github.com>2017-07-25 13:57:55 -0300
commit33fda932713de9db236d63098d88529f669fc49c (patch)
tree8ce106cdb17e4b13c3ae43bb04e589f0b98a7913
parente940aecfb9c51371d412230431339d2d124eeb81 (diff)
parentce0cf3c45739e0c7e1c1b48889a79e8bbc255495 (diff)
Merge pull request #657 from kalbasit/remove_whitespace_from_config_file
Settings: do not emit trailing whitespace
-rw-r--r--Settings.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/Settings.c b/Settings.c
index 0e296c10..dc5a9939 100644
--- a/Settings.c
+++ b/Settings.c
@@ -255,23 +255,29 @@ static bool Settings_read(Settings* this, const char* fileName) {
static void writeFields(FILE* fd, ProcessField* fields, const char* name) {
fprintf(fd, "%s=", name);
+ const char* sep = "";
for (int i = 0; fields[i]; i++) {
// This "-1" is for compatibility with the older enum format.
- fprintf(fd, "%d ", (int) fields[i]-1);
+ fprintf(fd, "%s%d", sep, (int) fields[i]-1);
+ sep = " ";
}
fprintf(fd, "\n");
}
static void writeMeters(Settings* this, FILE* fd, int column) {
+ const char* sep = "";
for (int i = 0; i < this->columns[column].len; i++) {
- fprintf(fd, "%s ", this->columns[column].names[i]);
+ fprintf(fd, "%s%s", sep, this->columns[column].names[i]);
+ sep = " ";
}
fprintf(fd, "\n");
}
static void writeMeterModes(Settings* this, FILE* fd, int column) {
+ const char* sep = "";
for (int i = 0; i < this->columns[column].len; i++) {
- fprintf(fd, "%d ", this->columns[column].modes[i]);
+ fprintf(fd, "%s%d", sep, this->columns[column].modes[i]);
+ sep = " ";
}
fprintf(fd, "\n");
}

© 2014-2024 Faster IT GmbH | imprint | privacy policy