diff options
Diffstat (limited to '')
-rw-r--r-- | libgamma.h | 4 | ||||
-rw-r--r-- | libgamma_value_of_connector_type.c | 7 | ||||
-rw-r--r-- | libgamma_value_of_subpixel_order.c | 7 | ||||
-rw-r--r-- | test.c | 12 |
4 files changed, 14 insertions, 16 deletions
@@ -1979,7 +1979,7 @@ const char *libgamma_const_of_connector_type(enum libgamma_connector_type); * "LIBGAMMA_CONNECTOR_TYPE_VGA"; * @return Zero on success, `LIBGAMMA_CONNECTOR_TYPE_NOT_RECOGNISED` of not defined */ -LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 1), __access__(__write_only__, 2), __pure__))) +LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 1), __access__(__write_only__, 2)))) int libgamma_value_of_connector_type(const char *, enum libgamma_connector_type *); @@ -2020,7 +2020,7 @@ const char *libgamma_const_of_subpixel_order(enum libgamma_subpixel_order); * "Horizontal RGB" and "LIBGAMMA_SUBPIXEL_ORDER_HORIZONTAL_RGB"; * @return Zero on success, `LIBGAMMA_SUBPIXEL_ORDER_NOT_RECOGNISED` of not defined */ -LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 1), __access__(__write_only__, 2), __pure__))) +LIBGAMMA_GCC_ONLY__(__attribute__((__nonnull__, __access__(__read_only__, 1), __access__(__write_only__, 2)))) int libgamma_value_of_subpixel_order(const char *, enum libgamma_subpixel_order *); diff --git a/libgamma_value_of_connector_type.c b/libgamma_value_of_connector_type.c index 395aed0..f42e1e5 100644 --- a/libgamma_value_of_connector_type.c +++ b/libgamma_value_of_connector_type.c @@ -16,15 +16,14 @@ int libgamma_value_of_connector_type(const char *connector, enum libgamma_connector_type *out) { #define X(CONST, NAME, ...)\ - if (!strcmp(connector, NAME)) {\ - *out = CONST;\ - return 0;\ - } + if (!strcmp(connector, NAME))\ + goto case_##CONST; LIST_CONNECTOR_TYPES(X) #undef X #define X(CONST, ...)\ if (!strcmp(connector, #CONST)) {\ + case_##CONST:\ *out = CONST;\ return 0;\ } diff --git a/libgamma_value_of_subpixel_order.c b/libgamma_value_of_subpixel_order.c index ed81435..1a66c9f 100644 --- a/libgamma_value_of_subpixel_order.c +++ b/libgamma_value_of_subpixel_order.c @@ -16,15 +16,14 @@ int libgamma_value_of_subpixel_order(const char *order, enum libgamma_subpixel_order *out) { #define X(CONST, NAME, ...)\ - if (!strcmp(order, NAME)) {\ - *out = CONST;\ - return 0;\ - } + if (!strcmp(order, NAME))\ + goto case_##CONST; LIST_SUBPIXEL_ORDERS(X) #undef X #define X(CONST, ...)\ if (!strcmp(order, #CONST)) {\ + case_##CONST:\ *out = CONST;\ return 0;\ } @@ -687,14 +687,14 @@ test_connector_types(void) exit(1);\ }\ type = (enum libgamma_connector_type)-1;\ - if (libgamma_value_of_connector_type(#CONST, &type) || type != CONST) { \ + if (libgamma_value_of_connector_type(#CONST, &type) || type != CONST) {\ fprintf(stderr, "libgamma_value_of_connector_type(\"%s\") != %s\n", #CONST, #CONST);\ exit(1);\ }\ type = (enum libgamma_connector_type)-1;\ - if (libgamma_value_of_connector_type(libgamma_name_of_connector_type(CONST), &type) || type != CONST) { \ + if (libgamma_value_of_connector_type(libgamma_name_of_connector_type(CONST), &type) || type != CONST) {\ fprintf(stderr, "libgamma_value_of_connector_type(libgamma_name_of_connector_type(%s)) != %s\n",\ - #CONST, #CONST);\ + #CONST, #CONST); \ exit(1);\ }\ type = (enum libgamma_connector_type)-1;\ @@ -795,18 +795,18 @@ test_subpixel_orders(void) exit(1);\ }\ order = (enum libgamma_subpixel_order)-1;\ - if (libgamma_value_of_subpixel_order(#CONST, &order) || order != CONST) { \ + if (libgamma_value_of_subpixel_order(#CONST, &order) || order != CONST) {\ fprintf(stderr, "libgamma_value_of_subpixel_order(\"%s\") != %s\n", #CONST, #CONST);\ exit(1);\ }\ order = (enum libgamma_subpixel_order)-1;\ - if (libgamma_value_of_subpixel_order(libgamma_name_of_subpixel_order(CONST), &order) || order != CONST) { \ + if (libgamma_value_of_subpixel_order(libgamma_name_of_subpixel_order(CONST), &order) || order != CONST) {\ fprintf(stderr, "libgamma_value_of_subpixel_order(libgamma_name_of_subpixel_order(%s)) != %s\n",\ #CONST, #CONST);\ exit(1);\ }\ order = (enum libgamma_subpixel_order)-1;\ - if (libgamma_value_of_subpixel_order(#CONST, &order) || order != CONST) { \ + if (libgamma_value_of_subpixel_order(#CONST, &order) || order != CONST) {\ fprintf(stderr, "libgamma_value_of_subpixel_order(\"%s\") != %s\n", #CONST, #CONST);\ exit(1);\ }\ |