diff options
author | Wael M. Nasreddine <wael.nasreddine@gmail.com> | 2017-07-24 16:36:27 -0700 |
---|---|---|
committer | Wael M. Nasreddine <wael.nasreddine@gmail.com> | 2017-07-24 16:36:27 -0700 |
commit | ce0cf3c45739e0c7e1c1b48889a79e8bbc255495 (patch) | |
tree | 8ce106cdb17e4b13c3ae43bb04e589f0b98a7913 /Settings.c | |
parent | e940aecfb9c51371d412230431339d2d124eeb81 (diff) |
Settings: do not emit trailing whitespace
Diffstat (limited to 'Settings.c')
-rw-r--r-- | Settings.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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"); } |