[geocode-glib] lib: Use DEFAULT_ANSWER_COUNT in test



commit 38b4169299f622d87cdda45622d4a9f7f0c5da6a
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Nov 26 14:43:44 2012 +0100

    lib: Use DEFAULT_ANSWER_COUNT in test

 geocode-glib/geocode-forward.c      |    2 --
 geocode-glib/geocode-glib-private.h |    1 +
 geocode-glib/test-gcglib.c          |    5 +++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/geocode-glib/geocode-forward.c b/geocode-glib/geocode-forward.c
index 2ed0678..7caf27b 100644
--- a/geocode-glib/geocode-forward.c
+++ b/geocode-glib/geocode-forward.c
@@ -46,8 +46,6 @@ struct _GeocodeForwardPrivate {
 
 G_DEFINE_TYPE (GeocodeForward, geocode_forward, G_TYPE_OBJECT)
 
-#define DEFAULT_ANSWER_COUNT 10
-
 static void geocode_forward_add (GeocodeForward *forward,
 				 const char     *key,
 				 const char     *value);
diff --git a/geocode-glib/geocode-glib-private.h b/geocode-glib/geocode-glib-private.h
index 6529849..d6b8610 100644
--- a/geocode-glib/geocode-glib-private.h
+++ b/geocode-glib/geocode-glib-private.h
@@ -28,6 +28,7 @@
 G_BEGIN_DECLS
 
 #define YAHOO_APPID "zznSbDjV34HRU5CXQc4D3qE1DzCsJTaKvWTLhNJxbvI_JTp1hIncJ4xTSJFRgjE-"
+#define DEFAULT_ANSWER_COUNT 10
 
 typedef enum {
 	GEOCODE_GLIB_RESOLVE_FORWARD,
diff --git a/geocode-glib/test-gcglib.c b/geocode-glib/test-gcglib.c
index 74af332..c5f392b 100644
--- a/geocode-glib/test-gcglib.c
+++ b/geocode-glib/test-gcglib.c
@@ -421,7 +421,7 @@ int main (int argc, char **argv)
 	GError *error = NULL;
 	GOptionContext *context;
 	gboolean do_rev_geocoding = FALSE;
-	int answer_count = 10;
+	int answer_count = DEFAULT_ANSWER_COUNT;
 	const GOptionEntry entries[] = {
 		{ "count", 0, 0, G_OPTION_ARG_INT, &answer_count, "Number of answers to get for forward searches", NULL },
 		{ "reverse", 0, 0, G_OPTION_ARG_NONE, &do_rev_geocoding, "Whether to do reverse geocoding for the given parameters", NULL },
@@ -460,7 +460,8 @@ int main (int argc, char **argv)
 		GeocodeForward *forward;
 
 		forward = geocode_forward_new_for_string (params[0]);
-		geocode_forward_set_answer_count (forward, answer_count);
+		if (answer_count != DEFAULT_ANSWER_COUNT)
+			geocode_forward_set_answer_count (forward, answer_count);
 		geocode_forward_search_async (forward, NULL, got_geocode_search_cb, NULL);
 	} else {
 		GeocodeReverse *reverse;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]