@@ -40,7 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4040
4141#include " cpp_common/combinations.hpp"
4242#include " cpp_common/pgdata_getters.hpp"
43- #include " cpp_common/alloc .hpp"
43+ #include " cpp_common/to_postgres .hpp"
4444#include " cpp_common/assert.hpp"
4545
4646#include " cpp_common/edge_xy_t.hpp"
@@ -61,7 +61,6 @@ void pgr_do_bdAstar(
6161 Path_rt **return_tuples, size_t *return_count,
6262 char ** log_msg, char ** notice_msg, char ** err_msg) {
6363 using pgrouting::Path;
64- using pgrouting::pgr_alloc;
6564 using pgrouting::to_pg_msg;
6665 using pgrouting::pgr_free;
6766 using pgrouting::utilities::get_combinations;
@@ -78,6 +77,8 @@ void pgr_do_bdAstar(
7877 pgassert (!(*return_tuples));
7978 pgassert (*return_count == 0 );
8079
80+ using pgrouting::to_postgres::get_tuples;
81+
8182 hint = combinations_sql;
8283 auto combinations = get_combinations (combinations_sql, starts, ends, true );
8384 hint = nullptr ;
@@ -111,20 +112,13 @@ void pgr_do_bdAstar(
111112 paths = pgrouting::algorithms::bdastar (graph, combinations, heuristic, factor, epsilon, only_cost);
112113 }
113114
114- size_t count (0 );
115- count = count_tuples (paths);
115+ (*return_count) = get_tuples (paths, (*return_tuples));
116116
117- if (count == 0 ) {
118- (*return_tuples) = nullptr ;
119- (*return_count) = 0 ;
120- notice << " No paths found\n " ;
121- *log_msg = to_pg_msg (notice);
117+ if (*return_count == 0 ) {
118+ *log_msg = to_pg_msg (" No paths found" );
122119 return ;
123120 }
124121
125- (*return_tuples) = pgr_alloc (count, (*return_tuples));
126- (*return_count) = (collapse_paths (return_tuples, paths));
127-
128122 *log_msg = to_pg_msg (log);
129123 *notice_msg = to_pg_msg (notice);
130124 } catch (AssertFailedException &except) {
0 commit comments