summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6569b43)
raw | patch | inline | side by side (parent: 6569b43)
| author | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:28:28 +0000 (05:28 +0000) | ||
| committer | gouldtj <gouldtj@users.sourceforge.net> | |
| Tue, 2 May 2006 05:28:28 +0000 (05:28 +0000) |
Moving the extension to be on the upper entry in defs so it is only once. Also optimizing by looking for a Quark.
| src/extension/parameter.cpp | patch | blob | history |
index 9b6d02f1703c19b899d0507ddcc898d12699ebd3..b407db9a935c8b0f69ca8a25ae84101efcf23fe0 100644 (file)
Inkscape::XML::Node *
Parameter::find_child (Inkscape::XML::Node * adult)
{
- Inkscape::XML::Node * retval = NULL;
- for (retval = adult->firstChild();
- retval != NULL;
- retval = retval->next()) {
- gchar const * name = retval->attribute("name");
- if (name == NULL) continue;
- if (!strcmp(name, _name))
- break;
- }
-
- return retval;
+ return sp_repr_lookup_child(adult, "name", _name);
}
Inkscape::XML::Node *
{
Inkscape::XML::Node * retval;
retval = sp_repr_new("inkscape:extension-param");
- retval->setAttribute("extension", extension->get_id());
retval->setAttribute("name", _name);
parent->appendChild(retval);
Inkscape::XML::Node * defs = SP_OBJECT_REPR(SP_DOCUMENT_DEFS(doc));
Inkscape::XML::Node * params = NULL;
+ GQuark const name_quark = g_quark_from_string("inkscape:extension-params");
+
for (Inkscape::XML::Node * child = defs->firstChild();
child != NULL;
child = child->next()) {
- if (!strcmp(child->name(), "inkscape:extension-param")) {
+ if ((GQuark)child->code() == name_quark &&
+ !strcmp(child->attribute("extension"), extension->get_id())) {
params = child;
break;
}
if (params == NULL) {
params = sp_repr_new("inkscape:extension-param");
+ params->setAttribute("extension", extension->get_id());
defs->appendChild(params);
}