diff options
author | Vincent Sanders <vince@kyllikki.org> | 2017-03-01 12:50:30 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2017-03-01 12:50:30 +0000 |
commit | 2f5e5620e218d317d5e853fd4ee9d9123b346610 (patch) | |
tree | 51a288d24f3f84699723ace7aed23eaa1f1d4df2 /desktop/system_colour.c | |
parent | e72b89ac3d691acb5c306c1565eaa1e559495ec8 (diff) | |
download | netsurf-2f5e5620e218d317d5e853fd4ee9d9123b346610.tar.gz netsurf-2f5e5620e218d317d5e853fd4ee9d9123b346610.tar.bz2 |
Change interface to system colours to allow reporting of errors
Allow system colour interface to report errors instead of silently
failing and propogate the errors. This also fixes teh system colour
documentation.
Diffstat (limited to 'desktop/system_colour.c')
-rw-r--r-- | desktop/system_colour.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/desktop/system_colour.c b/desktop/system_colour.c index f33b57a37..42a51eaea 100644 --- a/desktop/system_colour.c +++ b/desktop/system_colour.c @@ -16,9 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -/** \file - * System colour handling - * +/** + * \file + * System colour handling implementation. */ #include <string.h> @@ -38,6 +38,7 @@ static lwc_string *colour_list[colour_list_len]; static lwc_string **ns_system_colour_pw = NULL; +/* exported interface documented in desktop/system_colour.h */ nserror ns_system_colour_init(void) { unsigned int ccount; @@ -61,6 +62,8 @@ nserror ns_system_colour_init(void) return NSERROR_OK; } + +/* exported interface documented in desktop/system_colour.h */ void ns_system_colour_finalize(void) { unsigned int ccount; @@ -70,21 +73,25 @@ void ns_system_colour_finalize(void) } } -colour ns_system_colour_char(const char *name) + +/* exported interface documented in desktop/system_colour.h */ +nserror ns_system_colour_char(const char *name, colour *colour_out) { - colour ret = 0; unsigned int ccount; for (ccount = 0; ccount < colour_list_len; ccount++) { if (strcmp(name, nsoptions[ccount + NSOPTION_SYS_COLOUR_START].key + SLEN("sys_colour_")) == 0) { - ret = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c; - break; + *colour_out = nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c; + return NSERROR_OK; } } - return ret; + + return NSERROR_INVALID; } + +/* exported interface documented in desktop/system_colour.h */ css_error ns_system_colour(void *pw, lwc_string *name, css_color *colour) { unsigned int ccount; |