aboutsummaryrefslogtreecommitdiff
path: root/src/css.cc
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-12 21:32:10 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-12 21:32:10 +0100
commitc4641079e8dada86a5f4846ef8027f88c11c7294 (patch)
tree916b1b97637764a6ff0c137ebafe18264df89c1c /src/css.cc
parent9e91b27e37040fbc4a3c318b63fc9f4daf1385ba (diff)
avoid unnecessary lout::object::String creation
Diffstat (limited to 'src/css.cc')
-rw-r--r--src/css.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/css.cc b/src/css.cc
index 5fb5c272..6f4243f7 100644
--- a/src/css.cc
+++ b/src/css.cc
@@ -201,21 +201,26 @@ void CssStyleSheet::addRule (CssRule *rule) {
CssSimpleSelector *top = rule->selector->top ();
lout::misc::SimpleVector <CssRule*> *ruleList = NULL;
lout::object::Pointer *ruleListP;
+ lout::object::String *string;
if (top->id) {
- ruleListP = idTable->get (new lout::object::String (top->id));
+ string = new lout::object::String (top->id);
+ ruleListP = idTable->get (string);
if (ruleListP == NULL) {
ruleList = new lout::misc::SimpleVector <CssRule*> (1);
- idTable->put (new lout::object::String (top->id), new lout::object::Pointer (ruleList));
+ idTable->put (string, new lout::object::Pointer (ruleList));
} else {
+ delete string;
ruleList = (lout::misc::SimpleVector <CssRule*>*) ruleListP->getValue ();
}
} else if (top->klass) {
- ruleListP = classTable->get (new lout::object::String (top->klass));
+ string = new lout::object::String (top->klass);
+ ruleListP = classTable->get (string);
if (ruleListP == NULL) {
ruleList = new lout::misc::SimpleVector <CssRule*> (1);
- classTable->put (new lout::object::String (top->klass), new lout::object::Pointer (ruleList));
+ classTable->put (string, new lout::object::Pointer (ruleList));
} else {
+ delete string;
ruleList = (lout::misc::SimpleVector <CssRule*>*) ruleListP->getValue ();
}
} else if (top->element >= 0 && top->element < ntags) {