Allow removing things from this config. Still a ridiculously inefficient solution, of course.

This commit is contained in:
Alcaro
2016-05-01 17:02:57 +02:00
parent 7d54b5f271
commit 988561e2cc
4 changed files with 11 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
//Module name: Floating IPS, GTK+ frontend
//Author: Alcaro
//Date: See Git timestamps
//Date: See Git history
//Licence: GPL v3.0 or higher
//List of assumptions made whose correctness is not guaranteed by GTK+:

View File

@@ -251,7 +251,7 @@ void config::set(LPCWSTR name, LPCWSTR value)
if (!wcscmp(name, this->names[i]))
{
free(this->values[i]);
this->values[i] = wcsdup(value);
this->values[i] = (value!=NULL ? wcsdup(value) : NULL);
return;
}
}
@@ -292,7 +292,10 @@ LPWSTR config::flatten()
at += wsprintf(at, "%s", header);
for (size_t i=0;i<this->numentries;i++)
{
at += wsprintf(at, "%s=%s\n", this->names[i], this->values[i]);
if (this->values[i]!=NULL)
{
at += wsprintf(at, "%s=%s\n", this->names[i], this->values[i]);
}
}
return ret;

View File

@@ -1,6 +1,6 @@
//Module name: Floating IPS, header for all frontends
//Author: Alcaro
//Date: June 18, 2015
//Date: See Git history
//Licence: GPL v3.0 or higher
//Preprocessor switch documentation:
@@ -69,9 +69,9 @@
#include <ctype.h>
//Flips uses Windows type names internally, since it's easier to #define them to Linux types than
//defining "const char *" to anything else. Inventing my own typedefs seems counterproductive as
//well; they would bring no advantage over Windows typenames except not being Windows typenames, and
//I don't see that as a valid argument.
//defining "const char *" to anything else. I could invent my own typedefs, but the only advantage
//that would bring over Windows types would be not being Windows types, and I don't see that as a
//valid argument.
#define LPCWSTR const char *
#define LPWSTR char *

View File

@@ -1,6 +1,6 @@
//Module name: Floating IPS, global header
//Author: Alcaro
//Date: June 18, 2015
//Date: See Git history
//Licence: GPL v3.0 or higher
#ifndef struct_mem