From a3468904a6c729c5df6d613c74597ebba45d90f6 Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Wed, 27 Jul 2016 14:46:01 -0400 Subject: [PATCH] s/xml_reserved_element/xml_reserved_attribute. --- src/commands.c | 11 ++++++----- src/xml.c | 8 ++++---- src/xml.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/commands.c b/src/commands.c index dc0304cc..ee6ff985 100644 --- a/src/commands.c +++ b/src/commands.c @@ -1796,7 +1796,7 @@ again: { char **pa; - if (target && xml_reserved_element ((char *)a->name)) + if (target && xml_reserved_attribute ((char *)a->name)) continue; pa = xrealloc (attrlist, (i + 2) * sizeof (char *)); @@ -1880,7 +1880,7 @@ attribute_delete (struct client_s *client, char **args) if (!strcmp (args[0], "_name") || !strcmp (args[0], "target")) return GPG_ERR_INV_ATTR; - if (!xml_reserved_element (args[0])) + if (!xml_reserved_attribute (args[0])) n = xml_resolve_path (client, client->doc, (xmlChar *)args[1], NULL, &rc); else { @@ -1907,7 +1907,8 @@ attribute_delete (struct client_s *client, char **args) * Creates the "target" attribute. When other commands encounter an element * with this attribute they follow the "target" after appending remaining * elements from the original element path to the target. The exception is the - * ATTR command that operates on the element itself and not the target. + * ATTR command that operates on the element itself (for reserved attribute + * names) and not the target. * * If the source element path doesn't exist when using 'ATTR SET target', it is * created, but the destination element path must exist. This is simliar to the @@ -2000,7 +2001,7 @@ attribute_get (assuan_context_t ctx, char **args) if (!args || !args[0] || !*args[0] || !args[1] || !*args[1]) return GPG_ERR_SYNTAX; - if (!xml_reserved_element (args[0])) + if (!xml_reserved_attribute (args[0])) n = xml_resolve_path (client, client->doc, (xmlChar *)args[1], NULL, &rc); else { @@ -2058,7 +2059,7 @@ attribute_set (struct client_s *client, char **args) if (!xml_valid_attribute_value (args[2])) return GPG_ERR_INV_VALUE; - if (!xml_reserved_element (args[0])) + if (!xml_reserved_attribute (args[0])) n = xml_resolve_path (client, client->doc, (xmlChar *)args[1], NULL, &rc); else { diff --git a/src/xml.c b/src/xml.c index 2f32463d..bf37b91a 100644 --- a/src/xml.c +++ b/src/xml.c @@ -53,7 +53,7 @@ #define XML_LIST_TARGET_ERROR 0x0008 #define XML_LIST_CHECK 0x0010 -const char *reserved_elements[] = { +const char *reserved_attributes[] = { "_name", "_mtime", "_ctime", "_acl", "target", NULL }; @@ -1794,13 +1794,13 @@ xml_free_request (struct xml_request_s *r) } int -xml_reserved_element (const char *name) +xml_reserved_attribute (const char *name) { int i; - for (i = 0; reserved_elements[i]; i++) + for (i = 0; reserved_attributes[i]; i++) { - if (!strcmp (name, reserved_elements[i])) + if (!strcmp (name, reserved_attributes[i])) return 1; } diff --git a/src/xml.h b/src/xml.h index 6ec4fffe..5f8f214a 100644 --- a/src/xml.h +++ b/src/xml.h @@ -105,6 +105,6 @@ gpg_error_t xml_unlink_node (struct client_s *, xmlNodePtr); xmlNodePtr xml_create_element_path (struct client_s *client, struct xml_request_s *req, xmlNodePtr node, char **path, gpg_error_t *rc); -int xml_reserved_element (const char *); +int xml_reserved_attribute (const char *); #endif -- 2.11.4.GIT