diff options
| author | Thomas Holder <thomas@thomas-holder.de> | 2018-12-13 20:43:49 +0000 |
|---|---|---|
| committer | Thomas Holder <thomas@thomas-holder.de> | 2018-12-13 20:43:49 +0000 |
| commit | d4312f7cac4f6947719cda047645024a34c8795e (patch) | |
| tree | 180cea4ed59fbca47eb3740f8b8a940e18a97e25 /src/id-clash.cpp | |
| parent | remove most of Inkscape::URI::Impl (diff) | |
| download | inkscape-d4312f7cac4f6947719cda047645024a34c8795e.tar.gz inkscape-d4312f7cac4f6947719cda047645024a34c8795e.zip | |
extract_uri: fix, test, document
Diffstat (limited to 'src/id-clash.cpp')
| -rw-r--r-- | src/id-clash.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/id-clash.cpp b/src/id-clash.cpp index 2ee358d49..98c693e50 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -107,12 +107,11 @@ find_references(SPObject *elem, refmap_type &refmap) const char *attr = clipboard_properties[i]; const gchar *value = sp_repr_css_property(css, attr, nullptr); if (value) { - gchar *uri = extract_uri(value); - if (uri && uri[0] == '#') { + auto uri = extract_uri(value); + if (uri[0] == '#') { IdReference idref = { REF_CLIPBOARD, elem, attr }; - refmap[uri+1].push_back(idref); + refmap[uri.c_str() + 1].push_back(idref); } - g_free(uri); } } @@ -163,12 +162,11 @@ find_references(SPObject *elem, refmap_type &refmap) for (unsigned i = SP_MARKER_LOC_START; i < SP_MARKER_LOC_QTY; i++) { const gchar *value = style->marker_ptrs[i]->value; if (value) { - gchar *uri = extract_uri(value); - if (uri && uri[0] == '#') { + auto uri = extract_uri(value); + if (uri[0] == '#') { IdReference idref = { REF_STYLE, elem, markers[i] }; - refmap[uri+1].push_back(idref); + refmap[uri.c_str() + 1].push_back(idref); } - g_free(uri); } } @@ -177,12 +175,11 @@ find_references(SPObject *elem, refmap_type &refmap) const char *attr = other_url_properties[i]; const gchar *value = repr_elem->attribute(attr); if (value) { - gchar *uri = extract_uri(value); - if (uri && uri[0] == '#') { + auto uri = extract_uri(value); + if (uri[0] == '#') { IdReference idref = { REF_URL, elem, attr }; - refmap[uri+1].push_back(idref); + refmap[uri.c_str() + 1].push_back(idref); } - g_free(uri); } } |
