From bb1db6aa43a5f6c15dfa645ff15fecd463795cf6 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Fri, 6 Jul 2012 13:12:35 +0200 Subject: [PATCH] Define two locals always; to avoid GCC warning --- src/cqltransform.c | 6 ++---- src/solrtransform.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cqltransform.c b/src/cqltransform.c index b2422c9..aea8bdc 100644 --- a/src/cqltransform.c +++ b/src/cqltransform.c @@ -500,8 +500,7 @@ static int cql_pr_prox(cql_transform_t ct, struct cql_node *mods, void *client_data) { int exclusion = 0; - int distance; /* to be filled in later depending on unit */ - int distance_defined = 0; + int distance = -1; int ordered = 0; int proxrel = 2; /* less than or equal */ int unit = 2; /* word */ @@ -514,7 +513,6 @@ static int cql_pr_prox(cql_transform_t ct, struct cql_node *mods, if (!strcmp(name, "distance")) { distance = strtol(term, (char**) 0, 0); - distance_defined = 1; if (!strcmp(relation, "=")) proxrel = 3; else if (!strcmp(relation, ">")) @@ -564,7 +562,7 @@ static int cql_pr_prox(cql_transform_t ct, struct cql_node *mods, mods = mods->u.st.modifiers; } - if (!distance_defined) + if (distance == -1) distance = (unit == 2) ? 1 : 0; cql_pr_int(exclusion, pr, client_data); diff --git a/src/solrtransform.c b/src/solrtransform.c index 7e54519..2d8743b 100644 --- a/src/solrtransform.c +++ b/src/solrtransform.c @@ -522,8 +522,7 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, void *client_data) { int exclusion = 0; - int distance; /* to be filled in later depending on unit */ - int distance_defined = 0; + int distance = -1; int ordered = 0; int proxrel = 2; /* less than or equal */ int unit = 2; /* word */ @@ -536,7 +535,6 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, if (!strcmp(name, "distance")) { distance = strtol(term, (char**) 0, 0); - distance_defined = 1; if (!strcmp(relation, "=")) proxrel = 3; else if (!strcmp(relation, ">")) @@ -586,7 +584,7 @@ static int solr_pr_prox(solr_transform_t ct, struct solr_node *mods, mods = mods->u.st.modifiers; } - if (!distance_defined) + if (distance == -1) distance = (unit == 2) ? 1 : 0; solr_pr_int(exclusion, pr, client_data); -- 1.7.10.4