diff options
author | nyamatongwe <devnull@localhost> | 2004-06-09 12:18:02 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2004-06-09 12:18:02 +0000 |
commit | cee5d4acab43807697307b1aa2aa885f843ac542 (patch) | |
tree | cdc25ec45ecaecf459bf5282bb22027a58ddbdb6 /src | |
parent | a9584d12d1ba3ecd78ee7a71000691d80f7bd80d (diff) | |
download | scintilla-mirror-cee5d4acab43807697307b1aa2aa885f843ac542.tar.gz |
Unset function on PropSet.
Diffstat (limited to 'src')
-rw-r--r-- | src/PropSet.cxx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/PropSet.cxx b/src/PropSet.cxx index bf345145f..6c7145f02 100644 --- a/src/PropSet.cxx +++ b/src/PropSet.cxx @@ -383,6 +383,33 @@ void PropSet::Set(const char *keyVal) { } } +void PropSet::Unset(const char *key, int lenKey) { + if (!*key) // Empty keys are not supported + return; + if (lenKey == -1) + lenKey = static_cast<int>(strlen(key)); + unsigned int hash = HashString(key, lenKey); + Property *pPrev = NULL; + for (Property *p = props[hash % hashRoots]; p; p = p->next) { + if ((hash == p->hash) && + ((strlen(p->key) == static_cast<unsigned int>(lenKey)) && + (0 == strncmp(p->key, key, lenKey)))) { + if (pPrev) + pPrev->next = p->next; + else + props[hash % hashRoots] = p->next; + if (p == enumnext) + enumnext = p->next; // Not that anyone should mix enum and Set / Unset. + delete [](p->key); + delete [](p->val); + delete p; + return; + } else { + pPrev = p; + } + } +} + void PropSet::SetMultiple(const char *s) { const char *eol = strchr(s, '\n'); while (eol) { |