diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2017-01-22 15:58:49 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2017-02-08 17:27:13 +0000 |
commit | 91a7fffd5637574aea7a1b52308968a99dee888c (patch) | |
tree | 8ddeeb41fb089945ac6aee9776e1ca23895402e1 /utils/nsurl | |
parent | 2acd90e28a37a80f20e2780be7972764c699d9a0 (diff) | |
download | netsurf-91a7fffd5637574aea7a1b52308968a99dee888c.tar.gz netsurf-91a7fffd5637574aea7a1b52308968a99dee888c.tar.bz2 |
nsurl: Tidy up component helper macros.
Diffstat (limited to 'utils/nsurl')
-rw-r--r-- | utils/nsurl/nsurl.c | 9 | ||||
-rw-r--r-- | utils/nsurl/parse.c | 10 | ||||
-rw-r--r-- | utils/nsurl/private.h | 5 |
3 files changed, 12 insertions, 12 deletions
diff --git a/utils/nsurl/nsurl.c b/utils/nsurl/nsurl.c index 79dc71663..137a5acef 100644 --- a/utils/nsurl/nsurl.c +++ b/utils/nsurl/nsurl.c @@ -50,8 +50,13 @@ #undef NSURL_DEBUG -#define nsurl__component_copy(c) (c == NULL) ? NULL : lwc_string_ref(c) - +/** + * Compare two component values. + * + * Sets match to false if the components are not the same. + * Does nothing if the components are the same, so ensure match is + * preset to true. + */ #define nsurl__component_compare(c1, c2, match) \ if (c1 && c2 && lwc_error_ok == \ lwc_string_isequal(c1, c2, match)) { \ diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index e242689e1..2d74ea92c 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -81,16 +81,6 @@ enum url_sections { }; -#define nsurl__component_copy(c) (c == NULL) ? NULL : lwc_string_ref(c) - -#define nsurl__component_compare(c1, c2, match) \ - if (c1 && c2 && lwc_error_ok == \ - lwc_string_isequal(c1, c2, match)) { \ - /* do nothing */ \ - } else if (c1 || c2) { \ - *match = false; \ - } - /** * Return a hex digit for the given numerical value. * diff --git a/utils/nsurl/private.h b/utils/nsurl/private.h index bc3eb8c7e..a5291af21 100644 --- a/utils/nsurl/private.h +++ b/utils/nsurl/private.h @@ -107,6 +107,11 @@ enum nsurl_string_flags { NSURL_F_FRAGMENT = (1 << 11) }; +/** + * NULL-safe lwc_string_ref + */ +#define nsurl__component_copy(c) (c == NULL) ? NULL : lwc_string_ref(c) + /** * Convert a set of nsurl components to a single string |