php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #75501
Patch php7.patch revision 2017-11-08 15:15 UTC by yatsukhnenko at gmail dot com

Patch php7.patch for sphinx Bug #75501

Patch version 2017-11-08 15:15 UTC

Return to Bug #75501 | Download this patch
Patch Revisions:

Developer: yatsukhnenko@gmail.com

diff --git a/sphinx.c b/sphinx.c
index 8995df8..e673e18 100644
--- a/sphinx.c
+++ b/sphinx.c
@@ -366,10 +366,7 @@ static PHP_METHOD(SphinxClient, setServer)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_set_server(c->sphinx, server, (int)port);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -388,10 +385,7 @@ static PHP_METHOD(SphinxClient, setLimits)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_set_limits(c->sphinx, (int)offset, (int)limit, (int)max_matches, (int)cutoff);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -410,10 +404,7 @@ static PHP_METHOD(SphinxClient, setMatchMode)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_set_match_mode(c->sphinx, mode);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -468,10 +459,7 @@ static PHP_METHOD(SphinxClient, setIndexWeights)
 	efree(index_names);
 	efree(index_weights);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -492,10 +480,7 @@ static PHP_METHOD(SphinxClient, setSelect)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_set_select(c->sphinx, clause);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 #endif
@@ -515,10 +500,7 @@ static PHP_METHOD(SphinxClient, setIDRange)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_set_id_range(c->sphinx, (sphinx_uint64_t)min, (sphinx_uint64_t)max);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -555,10 +537,7 @@ static PHP_METHOD(SphinxClient, setFilter)
 	res = sphinx_add_filter(c->sphinx, attribute, num_values, u_values, exclude ? 1 : 0);
 	efree(u_values);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -580,10 +559,7 @@ static PHP_METHOD(SphinxClient, setFilterString)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_add_filter_string(c->sphinx, attribute, value, exclude ? 1 : 0);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 #endif
@@ -607,10 +583,7 @@ static PHP_METHOD(SphinxClient, setFilterRange)
 
 	res = sphinx_add_filter_range(c->sphinx, attribute, min, max, exclude);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -633,10 +606,7 @@ static PHP_METHOD(SphinxClient, setFilterFloatRange)
 
 	res = sphinx_add_filter_float_range(c->sphinx, attribute, min, max, exclude);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -658,10 +628,7 @@ static PHP_METHOD(SphinxClient, setGeoAnchor)
 
 	res = sphinx_set_geoanchor(c->sphinx, attrlat, attrlong, latitude, longitude);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -692,10 +659,7 @@ static PHP_METHOD(SphinxClient, setGroupBy)
 
 	res = sphinx_set_groupby(c->sphinx, attribute, func, groupsort);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -716,10 +680,7 @@ static PHP_METHOD(SphinxClient, setGroupDistinct)
 
 	res = sphinx_set_groupby_distinct(c->sphinx, attribute);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -739,10 +700,7 @@ static PHP_METHOD(SphinxClient, setRetries)
 
 	res = sphinx_set_retries(c->sphinx, (int)count, (int)delay);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -762,10 +720,7 @@ static PHP_METHOD(SphinxClient, setMaxQueryTime)
 
 	res = sphinx_set_max_query_time(c->sphinx, (int)qtime);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -788,10 +743,7 @@ static PHP_METHOD(SphinxClient, setRankingMode)
 
 	res = sphinx_set_ranking_mode(c->sphinx, (int)ranker, rank_expr);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 #else
@@ -811,10 +763,7 @@ static PHP_METHOD(SphinxClient, setRankingMode)
 
 	res = sphinx_set_ranking_mode(c->sphinx, (int)ranker);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 #endif
@@ -871,10 +820,7 @@ static PHP_METHOD(SphinxClient, setFieldWeights)
 	efree(field_names);
 	efree(field_weights);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -896,10 +842,7 @@ static PHP_METHOD(SphinxClient, setSortMode)
 
 	res = sphinx_set_sort_mode(c->sphinx, (int)mode, sortby);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -919,10 +862,7 @@ static PHP_METHOD(SphinxClient, setConnectTimeout)
 
 	res = sphinx_set_connect_timeout(c->sphinx, timeout);
 
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -1532,7 +1472,7 @@ static PHP_METHOD(SphinxClient, escapeString)
 
 	new_str_len = target - new_str;
 	new_str = erealloc(new_str, new_str_len + 1);
-	RETURN_STRINGL(new_str, new_str_len);
+	RETVAL_STRINGL(new_str, new_str_len);
 	efree(new_str);
 }
 /* }}} */
@@ -1548,10 +1488,7 @@ static PHP_METHOD(SphinxClient, open)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_open(c->sphinx);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -1565,10 +1502,7 @@ static PHP_METHOD(SphinxClient, close)
 	SPHINX_INITIALIZED(c)
 
 	res = sphinx_close(c->sphinx);
-	if (!res) {
-		RETURN_FALSE;
-	}
-	RETURN_TRUE;
+	RETURN_BOOL(res);
 }
 /* }}} */
 
@@ -1675,11 +1609,7 @@ static PHP_METHOD(SphinxClient, setOverride)
 	}
 
 	res = sphinx_add_override(c->sphinx, attribute, docids, values_num, vals);
-	if (!res) {
-		RETVAL_FALSE;
-	} else {
-		RETVAL_TRUE;
-	}
+	RETURN_BOOL(res);
 
 cleanup:
 	if (docids) {
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 23:01:34 2024 UTC