@@ -61,7 +61,7 @@ void pgr_do_astar(
6161 char ** log_msg, char ** notice_msg, char ** err_msg) {
6262 using pgrouting::Path;
6363 using pgrouting::pgr_alloc;
64- using pgrouting::pgr_msg ;
64+ using pgrouting::to_pg_msg ;
6565 using pgrouting::pgr_free;
6666 using pgrouting::utilities::get_combinations;
6767
@@ -85,8 +85,8 @@ void pgr_do_astar(
8585 hint = nullptr ;
8686
8787 if (combinations.empty () && combinations_sql) {
88- *notice_msg = pgr_msg (" No (source, target) pairs found" );
89- *log_msg = pgr_msg (combinations_sql);
88+ *notice_msg = to_pg_msg (" No (source, target) pairs found" );
89+ *log_msg = to_pg_msg (combinations_sql);
9090 return ;
9191 }
9292
@@ -96,8 +96,8 @@ void pgr_do_astar(
9696 hint = nullptr ;
9797
9898 if (edges.empty ()) {
99- *notice_msg = pgr_msg (" No edges found" );
100- *log_msg = pgr_msg (edges_sql);
99+ *notice_msg = to_pg_msg (" No edges found" );
100+ *log_msg = to_pg_msg (edges_sql);
101101 return ;
102102 }
103103
@@ -128,39 +128,35 @@ void pgr_do_astar(
128128 (*return_tuples) = nullptr ;
129129 (*return_count) = 0 ;
130130 notice << " No paths found\n " ;
131- *log_msg = pgr_msg (notice. str (). c_str () );
131+ *log_msg = to_pg_msg (notice);
132132 return ;
133133 }
134134
135135 (*return_tuples) = pgr_alloc (count, (*return_tuples));
136136 (*return_count) = (collapse_paths (return_tuples, paths));
137137
138- *log_msg = log.str ().empty ()?
139- *log_msg :
140- pgr_msg (log.str ().c_str ());
141- *notice_msg = notice.str ().empty ()?
142- *notice_msg :
143- pgr_msg (notice.str ().c_str ());
138+ *log_msg = to_pg_msg (log);
139+ *notice_msg = to_pg_msg (notice);
144140 } catch (AssertFailedException &except) {
145141 (*return_tuples) = pgr_free (*return_tuples);
146142 (*return_count) = 0 ;
147143 err << except.what ();
148- *err_msg = pgr_msg (err. str (). c_str () );
149- *log_msg = pgr_msg (log. str (). c_str () );
144+ *err_msg = to_pg_msg (err);
145+ *log_msg = to_pg_msg (log);
150146 } catch (const std::string &ex) {
151- *err_msg = pgr_msg (ex. c_str () );
152- *log_msg = hint? pgr_msg (hint) : pgr_msg (log. str (). c_str () );
147+ *err_msg = to_pg_msg (ex);
148+ *log_msg = hint? to_pg_msg (hint) : to_pg_msg (log);
153149 } catch (std::exception &except) {
154150 (*return_tuples) = pgr_free (*return_tuples);
155151 (*return_count) = 0 ;
156152 err << except.what ();
157- *err_msg = pgr_msg (err. str (). c_str () );
158- *log_msg = pgr_msg (log. str (). c_str () );
153+ *err_msg = to_pg_msg (err);
154+ *log_msg = to_pg_msg (log);
159155 } catch (...) {
160156 (*return_tuples) = pgr_free (*return_tuples);
161157 (*return_count) = 0 ;
162158 err << " Caught unknown exception!" ;
163- *err_msg = pgr_msg (err. str (). c_str () );
164- *log_msg = pgr_msg (log. str (). c_str () );
159+ *err_msg = to_pg_msg (err);
160+ *log_msg = to_pg_msg (log);
165161 }
166162}
0 commit comments