diff options
| author | Neil <nyamatongwe@gmail.com> | 2020-07-16 19:55:15 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2020-07-16 19:55:15 +1000 | 
| commit | b3c9933350e5c6b9d06a72034e681cecae52dc4b (patch) | |
| tree | a733fba3b608ba75f4c55ec27cc6026697fdd3b0 /lexlib/PropSetSimple.cxx | |
| parent | 08b502cac1f88bc511c324ab7eb23d34c4318bd7 (diff) | |
| download | scintilla-mirror-b3c9933350e5c6b9d06a72034e681cecae52dc4b.tar.gz | |
Add constexpr, const, noexcept and make other small improvements to lexlib.
Diffstat (limited to 'lexlib/PropSetSimple.cxx')
| -rw-r--r-- | lexlib/PropSetSimple.cxx | 14 | 
1 files changed, 7 insertions, 7 deletions
diff --git a/lexlib/PropSetSimple.cxx b/lexlib/PropSetSimple.cxx index 6e1312527..6ee57d667 100644 --- a/lexlib/PropSetSimple.cxx +++ b/lexlib/PropSetSimple.cxx @@ -21,10 +21,14 @@ namespace {  typedef std::map<std::string, std::string> mapss; -mapss *PropsFromPointer(void *impl) { +mapss *PropsFromPointer(void *impl) noexcept {  	return static_cast<mapss *>(impl);  } +constexpr bool IsASpaceCharacter(int ch) noexcept { +	return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} +  }  PropSetSimple::PropSetSimple() { @@ -35,7 +39,7 @@ PropSetSimple::PropSetSimple() {  PropSetSimple::~PropSetSimple() {  	mapss *props = PropsFromPointer(impl);  	delete props; -	impl = 0; +	impl = nullptr;  }  void PropSetSimple::Set(const char *key, const char *val, size_t lenKey, size_t lenVal) { @@ -45,10 +49,6 @@ void PropSetSimple::Set(const char *key, const char *val, size_t lenKey, size_t  	(*props)[std::string(key, lenKey)] = std::string(val, lenVal);  } -static bool IsASpaceCharacter(unsigned int ch) { -    return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} -  void PropSetSimple::Set(const char *keyVal) {  	while (IsASpaceCharacter(*keyVal))  		keyVal++; @@ -90,7 +90,7 @@ const char *PropSetSimple::Get(const char *key) const {  // for that, through a recursive function and a simple chain of pointers.  struct VarChain { -	VarChain(const char *var_=nullptr, const VarChain *link_= nullptr): var(var_), link(link_) {} +	VarChain(const char *var_=nullptr, const VarChain *link_= nullptr) noexcept : var(var_), link(link_) {}  	bool contains(const char *testVar) const {  		return (var && (0 == strcmp(var, testVar)))  | 
