Преглед на файлове

faux.ini: Tab is space also

Serj Kalichev преди 4 години
родител
ревизия
5024367210
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      faux/ini/ini.c

+ 3 - 2
faux/ini/ini.c

@@ -424,6 +424,7 @@ int faux_ini_write_file(const faux_ini_t *ini, const char *fn) {
 	FILE *fd = NULL;
 	faux_ini_node_t *iter = NULL;
 	const faux_pair_t *pair = NULL;
+	const char *spaces = " \t";
 
 	assert(ini);
 	assert(fn);
@@ -444,12 +445,12 @@ int faux_ini_write_file(const faux_ini_t *ini, const char *fn) {
 
 		// Print name field
 		// Word with spaces needs quotes
-		quote = strchr(name, ' ') ? "\"" : "";
+		quote = faux_str_chars(name, spaces) ? "\"" : "";
 		fprintf(fd, "%s%s%s=", quote, name, quote);
 
 		// Print value field
 		// Word with spaces needs quotes
-		quote = strchr(value, ' ') ? "\"" : "";
+		quote = faux_str_chars(value, spaces) ? "\"" : "";
 		fprintf(fd, "%s%s%s\n", quote, value, quote);
 	}