aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ViewStyle.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/ViewStyle.cxx')
-rw-r--r--src/ViewStyle.cxx23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 39661ddc2..7a0b146f8 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -19,9 +19,7 @@
#include "Scintilla.h"
#include "Position.h"
-#include "SplitVector.h"
-#include "Partitioning.h"
-#include "RunStyles.h"
+#include "UniqueString.h"
#include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h"
@@ -45,26 +43,21 @@ FontNames::~FontNames() {
}
void FontNames::Clear() {
- for (const char *name : names) {
- delete []name;
- }
names.clear();
}
const char *FontNames::Save(const char *name) {
if (!name)
- return 0;
+ return nullptr;
- for (const char *nm : names) {
- if (strcmp(nm, name) == 0) {
- return nm;
+ for (const UniqueString &nm : names) {
+ if (strcmp(nm.get(), name) == 0) {
+ return nm.get();
}
}
- const size_t lenName = strlen(name) + 1;
- char *nameSave(new char[lenName]);
- memcpy(nameSave, name, lenName);
- names.push_back(nameSave);
- return nameSave;
+
+ names.push_back(UniqueStringCopy(name));
+ return names.back().get();
}
FontRealised::FontRealised() {