[geocode-glib] lib: Remove easy to forget constant
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] lib: Remove easy to forget constant
- Date: Mon, 16 Sep 2013 17:48:45 +0000 (UTC)
commit 9256ef6bfa9ff293e0968049436b30ba1dcbf4bf
Author: Bastien Nocera <hadess hadess net>
Date: Mon Sep 9 19:56:27 2013 -0300
lib: Remove easy to forget constant
The constant was defined, unused in the declaration of the
array it was supposed to tell the length of, and used more than
200 lines down.
Instead, remove all constants, and use G_N_ELEMENTS() for our
use inside the function. It will get turned into a constant by
the compiler.
https://bugzilla.gnome.org/show_bug.cgi?id=707812
geocode-glib/geocode-forward.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/geocode-glib/geocode-forward.c b/geocode-glib/geocode-forward.c
index 4afada8..a23832d 100644
--- a/geocode-glib/geocode-forward.c
+++ b/geocode-glib/geocode-forward.c
@@ -532,8 +532,7 @@ node_free_func (GNode *node,
return FALSE;
}
-#define N_ATTRS 8
-static const char const *attributes[8] = {
+static const char const *attributes[] = {
"country",
"state",
"county",
@@ -783,7 +782,7 @@ _geocode_parse_search_json (const char *contents,
const GError *err = NULL;
int num_places, i;
GNode *place_tree;
- char *s_array[N_ATTRS];
+ char *s_array[G_N_ELEMENTS (attributes)];
ret = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]