diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-07-07 18:18:48 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2012-07-07 18:18:48 +0100 |
commit | e03978c667b83627073498ca34c61cf267934c41 (patch) | |
tree | b00b2061b386fc929b08150870f208fee2bebacb /src | |
parent | 890da96b1b601f622a12a7832c3cb654b146e693 (diff) | |
download | libdom-e03978c667b83627073498ca34c61cf267934c41.tar.gz libdom-e03978c667b83627073498ca34c61cf267934c41.tar.bz2 |
HTML{Form,Link,Meta}Element: Tidy up SIMPLE_GET_SET
Diffstat (limited to 'src')
-rw-r--r-- | src/html/html_form_element.c | 60 | ||||
-rw-r--r-- | src/html/html_link_element.c | 68 | ||||
-rw-r--r-- | src/html/html_meta_element.c | 58 |
3 files changed, 99 insertions, 87 deletions
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c index 0688cd6..d0a453d 100644 --- a/src/html/html_form_element.c +++ b/src/html/html_form_element.c @@ -184,42 +184,46 @@ dom_exception dom_html_form_element_get_length(dom_html_form_element *ele, return dom_html_collection_get_length(ele->col, len); } -#define SIMPLE_GET_SET(fattr,attr) \ -dom_exception dom_html_form_element_get_##fattr(dom_html_form_element *element, \ - dom_string **fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ +#define SIMPLE_GET_SET(attr) \ + dom_exception dom_html_form_element_get_##attr( \ + dom_html_form_element *element, \ + dom_string **attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_get_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} \ + return ret; \ + } \ \ -dom_exception dom_html_form_element_set_##fattr(dom_html_form_element *element, \ - dom_string *fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ + dom_exception dom_html_form_element_set_##attr( \ + dom_html_form_element *element, \ + dom_string *attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_set_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} + return ret; \ + } -SIMPLE_GET_SET(accept_charset,accept_charset) -SIMPLE_GET_SET(action,action) -SIMPLE_GET_SET(enctype,enctype) -SIMPLE_GET_SET(method,method) -SIMPLE_GET_SET(target,target) +SIMPLE_GET_SET(accept_charset) +SIMPLE_GET_SET(action) +SIMPLE_GET_SET(enctype) +SIMPLE_GET_SET(method) +SIMPLE_GET_SET(target) /** diff --git a/src/html/html_link_element.c b/src/html/html_link_element.c index cf3d0e9..8e9a302 100644 --- a/src/html/html_link_element.c +++ b/src/html/html_link_element.c @@ -149,42 +149,46 @@ dom_exception _dom_html_link_element_copy(dom_node_internal *old, /*-----------------------------------------------------------------------*/ /* API functions */ -#define SIMPLE_GET_SET(fattr,attr) \ -dom_exception dom_html_link_element_get_##fattr(dom_html_link_element *element, \ - dom_string **fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ +#define SIMPLE_GET_SET(attr) \ + dom_exception dom_html_link_element_get_##attr( \ + dom_html_link_element *element, \ + dom_string **attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_get_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} \ + return ret; \ + } \ \ -dom_exception dom_html_link_element_set_##fattr(dom_html_link_element *element, \ - dom_string *fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ + dom_exception dom_html_link_element_set_##attr( \ + dom_html_link_element *element, \ + dom_string *attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_set_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} - -SIMPLE_GET_SET(charset,charset) -SIMPLE_GET_SET(href,href) -SIMPLE_GET_SET(hreflang,hreflang) -SIMPLE_GET_SET(media,media) -SIMPLE_GET_SET(rel,rel) -SIMPLE_GET_SET(rev,rev) -SIMPLE_GET_SET(target,target) -SIMPLE_GET_SET(type,type) + return ret; \ + } + +SIMPLE_GET_SET(charset) +SIMPLE_GET_SET(href) +SIMPLE_GET_SET(hreflang) +SIMPLE_GET_SET(media) +SIMPLE_GET_SET(rel) +SIMPLE_GET_SET(rev) +SIMPLE_GET_SET(target) +SIMPLE_GET_SET(type) diff --git a/src/html/html_meta_element.c b/src/html/html_meta_element.c index 9cc8067..7a254e6 100644 --- a/src/html/html_meta_element.c +++ b/src/html/html_meta_element.c @@ -116,38 +116,42 @@ dom_exception _dom_html_meta_element_copy(dom_node_internal *old, /*-----------------------------------------------------------------------*/ /* API functions */ -#define SIMPLE_GET_SET(fattr,attr) \ -dom_exception dom_html_meta_element_get_##fattr(dom_html_meta_element *element, \ - dom_string **fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ +#define SIMPLE_GET_SET(attr) \ + dom_exception dom_html_meta_element_get_##attr( \ + dom_html_meta_element *element, \ + dom_string **attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_get_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_get_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} \ + return ret; \ + } \ \ -dom_exception dom_html_meta_element_set_##fattr(dom_html_meta_element *element, \ - dom_string *fattr) \ -{ \ - dom_exception ret; \ - dom_string *_memo_##attr; \ + dom_exception dom_html_meta_element_set_##attr( \ + dom_html_meta_element *element, \ + dom_string *attr) \ + { \ + dom_exception ret; \ + dom_string *_memo_##attr; \ \ - _memo_##attr = \ - ((struct dom_html_document *) \ - ((struct dom_node_internal *)element)->owner)->memoised[hds_##attr]; \ + _memo_##attr = \ + ((struct dom_html_document *) \ + ((struct dom_node_internal *)element)->owner)->\ + memoised[hds_##attr]; \ \ - ret = dom_element_set_attribute(element, _memo_##attr, fattr); \ + ret = dom_element_set_attribute(element, _memo_##attr, attr); \ \ - return ret; \ -} + return ret; \ + } -SIMPLE_GET_SET(content,content) -SIMPLE_GET_SET(http_equiv,http_equiv) -SIMPLE_GET_SET(name,name) -SIMPLE_GET_SET(scheme,scheme) +SIMPLE_GET_SET(content) +SIMPLE_GET_SET(http_equiv) +SIMPLE_GET_SET(name) +SIMPLE_GET_SET(scheme) |