[gegl] Use G_N_ELEMENTS
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Use G_N_ELEMENTS
- Date: Sat, 15 May 2010 15:33:12 +0000 (UTC)
commit 68a237f9a4ca90340419a38365b1fbef81ce6b5a
Author: Martin Nordholts <martinn src gnome org>
Date: Fri May 14 16:32:38 2010 +0200
Use G_N_ELEMENTS
gegl/property-types/gegl-color.c | 4 +---
tests/buffer/buffer-test.c | 2 +-
tests/test-gegl-rectangle.c | 4 +---
3 files changed, 3 insertions(+), 7 deletions(-)
---
diff --git a/gegl/property-types/gegl-color.c b/gegl/property-types/gegl-color.c
index e977006..d4236a1 100644
--- a/gegl/property-types/gegl-color.c
+++ b/gegl/property-types/gegl-color.c
@@ -180,11 +180,9 @@ parse_color_name (GeglColor *color,
const gchar *color_string)
{
GeglColorPrivate *priv = GEGL_COLOR_GET_PRIVATE (color);
-
- gint num_color_names = sizeof (color_names) / sizeof (color_names[0]);
gint i;
- for (i = 0; i < num_color_names; ++i)
+ for (i = 0; i < G_N_ELEMENTS (color_names); ++i)
{
if (g_ascii_strcasecmp (color_names[i].color_name, color_string) == 0)
{
diff --git a/tests/buffer/buffer-test.c b/tests/buffer/buffer-test.c
index 1975709..116b97d 100644
--- a/tests/buffer/buffer-test.c
+++ b/tests/buffer/buffer-test.c
@@ -296,7 +296,7 @@ gint main (gint argc, gchar **argv)
system ("mkdir output > /dev/null 2>&1");
- for (i=0; i<sizeof(tests)/sizeof(tests[0]);i++)
+ for (i=0; i < G_N_ELEMENTS (tests); i++)
{
gchar *ret;
diff --git a/tests/test-gegl-rectangle.c b/tests/test-gegl-rectangle.c
index 6abaa5b..886774f 100644
--- a/tests/test-gegl-rectangle.c
+++ b/tests/test-gegl-rectangle.c
@@ -26,8 +26,6 @@
#define INFINITE_PLANE G_MININT / 2, G_MININT / 2, G_MAXINT, G_MAXINT
-#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
-
typedef struct
{
GeglRectangle rect1;
@@ -180,7 +178,7 @@ int main(int argc, char *argv[])
goto abort;
}
- for (i = 0; i < ARRAY_SIZE (tests); i++)
+ for (i = 0; i < G_N_ELEMENTS (tests); i++)
{
GeglRectangle result_rect;
gboolean return_value;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]