Changeset 2a06f129a8ded380b2b27047520ceb04dfc9a0b0
- Timestamp:
- 03/27/12 20:58:43
(1 year ago)
- Author:
- Theo Schlossnagle <jesus@omniti.com>
- git-committer:
- Theo Schlossnagle <jesus@omniti.com> 1332881923 +0000
- git-parent:
[2148d594359c81ffc07674617e97eef16818690f]
- git-author:
- Theo Schlossnagle <jesus@omniti.com> 1332881923 +0000
- Message:
config name attribute was not supported under checks/set
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rc4fc37f |
r2a06f12 |
|
| 48 | 48 | #define FAIL(a) do { error = (a); goto error; } while(0) |
|---|
| 49 | 49 | |
|---|
| 50 | | #define NS_NODE_CONTENT(parent, ns, k, v) do { \ |
|---|
| | 50 | #define NS_NODE_CONTENT(parent, ns, k, v, followup) do { \ |
|---|
| 51 | 51 | xmlNodePtr tmp; \ |
|---|
| 52 | 52 | if(v) { \ |
|---|
| 53 | 53 | tmp = xmlNewNode(ns, (xmlChar *)(k)); \ |
|---|
| 54 | 54 | xmlNodeAddContent(tmp, (xmlChar *)(v)); \ |
|---|
| | 55 | followup \ |
|---|
| 55 | 56 | xmlAddChild(parent, tmp); \ |
|---|
| 56 | 57 | } \ |
|---|
| 57 | 58 | } while(0) |
|---|
| 58 | | #define NODE_CONTENT(parent, k, v) NS_NODE_CONTENT(parent, NULL, k, v) |
|---|
| | 59 | #define NODE_CONTENT(parent, k, v) NS_NODE_CONTENT(parent, NULL, k, v, ) |
|---|
| 59 | 60 | |
|---|
| 60 | 61 | xmlNodePtr |
|---|
| … | … | |
| 221 | 222 | snprintf(buff, sizeof(buff), "noit://module/%s", nsname); |
|---|
| 222 | 223 | ns = xmlNewNs(config, (xmlChar *)buff, (xmlChar *)nsname); |
|---|
| 223 | | if(NULL != (configh = noit_conf_get_namespaced_hash(node, "config", nsname))) { |
|---|
| 224 | | while(noit_hash_next(configh, &iter, &k, &klen, &data)) |
|---|
| 225 | | NS_NODE_CONTENT(config, ns, k, data); |
|---|
| | 224 | configh = noit_conf_get_namespaced_hash(node, "config", nsname); |
|---|
| | 225 | if(configh) { |
|---|
| | 226 | memset(&iter, 0, sizeof(iter)); |
|---|
| | 227 | while(noit_hash_next(configh, &iter, &k, &klen, &data)) { |
|---|
| | 228 | NS_NODE_CONTENT(config, ns, "value", data, |
|---|
| | 229 | xmlSetProp(tmp, (xmlChar *)"name", (xmlChar *)k); |
|---|
| | 230 | ); |
|---|
| | 231 | } |
|---|
| 226 | 232 | noit_hash_destroy(configh, free, free); |
|---|
| 227 | 233 | free(configh); |
|---|
| … | … | |
| 411 | 417 | } |
|---|
| 412 | 418 | xmlNodePtr co = xmlNewNode(targetns, n->name); |
|---|
| | 419 | if(n->ns && !strcmp((char *)n->name, "value")) { |
|---|
| | 420 | xmlChar *name = xmlGetProp(n, (xmlChar *)"name"); |
|---|
| | 421 | if(name) xmlSetProp(co, (xmlChar *)"name", name); |
|---|
| | 422 | } |
|---|
| 413 | 423 | xmlNodeAddContent(co, v); |
|---|
| 414 | 424 | xmlFree(v); |
|---|