From 1f73cd6cf5f45c6291c0d4eb1e782e66e0a8cfc1 Mon Sep 17 00:00:00 2001 From: Vicky Vergara Date: Sat, 25 Mar 2023 11:36:37 -0600 Subject: [PATCH] To cpp arrays input (#2497) * :truck: moving arrays_input for cpp compilation * :hammer: arrays_input is compiled as cpp and linked as C * :wrench: adjusting code to the one function for getting integer arrays from postgres * :books: :bug: fixing doxygen documentation --- include/c_common/arrays_input.h | 17 +++- src/astar/astar.c | 8 +- src/bdAstar/bdAstar.c | 4 +- src/bdDijkstra/bdDijkstra.c | 4 +- src/bellman_ford/bellman_ford.c | 4 +- src/bellman_ford/bellman_ford_neg.c | 4 +- src/bellman_ford/edwardMoore.c | 4 +- .../binaryBreadthFirstSearch.c | 4 +- src/breadthFirstSearch/breadthFirstSearch.c | 2 +- src/circuits/hawickCircuits.c | 2 - src/coloring/edgeColoring.c | 2 - src/coloring/sequentialVertexColoring.c | 2 - src/common/CMakeLists.txt | 1 - src/common/get_check_data.c | 2 +- src/contraction/contractGraph.c | 10 +- src/cpp_common/CMakeLists.txt | 1 + .../arrays_input.cpp} | 96 +++++++++---------- src/dagShortestPath/dagShortestPath.c | 4 +- src/dijkstra/dijkstra.c | 8 +- src/dijkstra/dijkstraVia.c | 2 +- .../many_to_dist_driving_distance.c | 2 +- .../many_to_dist_withPointsDD.c | 2 +- src/max_flow/edge_disjoint_paths.c | 4 +- src/max_flow/max_flow.c | 4 +- src/max_flow/minCostMaxFlow.c | 4 +- src/ordering/cuthillMckeeOrdering.c | 2 - src/spanningTree/kruskal.c | 2 +- src/spanningTree/prim.c | 2 +- src/traversal/depthFirstSearch.c | 4 +- src/trsp/new_trsp.c | 4 +- src/trsp/trspVia.c | 2 +- src/trsp/trspVia_withPoints.c | 2 +- src/trsp/trsp_withPoints.c | 4 +- src/withPoints/withPoints.c | 8 +- src/withPoints/withPointsVia.c | 2 +- 35 files changed, 105 insertions(+), 124 deletions(-) rename src/{common/arrays_input.c => cpp_common/arrays_input.cpp} (59%) diff --git a/include/c_common/arrays_input.h b/include/c_common/arrays_input.h index 821defd0ea7..41e55808b76 100644 --- a/include/c_common/arrays_input.h +++ b/include/c_common/arrays_input.h @@ -1,8 +1,9 @@ /*PGR-GNU***************************************************************** File: arrays_input.h +Copyright (c) 2023 Celia Virginia Vergara Castillo Copyright (c) 2015 Celia Virginia Vergara Castillo -vicky_vergara@hotmail.com +mail: vicky at erosion.dev ------ @@ -26,15 +27,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #define INCLUDE_C_COMMON_ARRAYS_INPUT_H_ #pragma once - +#include #include + +#ifdef __cplusplus +extern "C" { +#endif + #include #include /** @brief Enforces the input array to be @b NOT empty */ -int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input); +int64_t* pgr_get_bigIntArray(size_t*, ArrayType*, bool); -/** @brief Allows the input array to be empty */ -int64_t* pgr_get_bigIntArray_allowEmpty(size_t *arrlen, ArrayType *input); +#ifdef __cplusplus +} +#endif #endif // INCLUDE_C_COMMON_ARRAYS_INPUT_H_ diff --git a/src/astar/astar.c b/src/astar/astar.c index ab5aca5f31f..580302e11f5 100644 --- a/src/astar/astar.c +++ b/src/astar/astar.c @@ -102,18 +102,18 @@ process(char* edges_sql, pgr_get_edges_xy(edges_sql, &edges, &total_edges, true); if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } } else { pgr_get_edges_xy(edges_sql, &edges, &total_edges, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, starts); + pgr_get_bigIntArray(&size_end_vidsArr, starts, false); start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, ends); + pgr_get_bigIntArray(&size_start_vidsArr, ends, false); } if (total_edges == 0) { diff --git a/src/bdAstar/bdAstar.c b/src/bdAstar/bdAstar.c index 1f17f5f83e2..c5683c308a6 100644 --- a/src/bdAstar/bdAstar.c +++ b/src/bdAstar/bdAstar.c @@ -77,9 +77,9 @@ process(char* edges_sql, if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } diff --git a/src/bdDijkstra/bdDijkstra.c b/src/bdDijkstra/bdDijkstra.c index f28c078b4ba..a671d15f7be 100644 --- a/src/bdDijkstra/bdDijkstra.c +++ b/src/bdDijkstra/bdDijkstra.c @@ -75,9 +75,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } diff --git a/src/bellman_ford/bellman_ford.c b/src/bellman_ford/bellman_ford.c index c5fb7850817..ae55fdcc680 100644 --- a/src/bellman_ford/bellman_ford.c +++ b/src/bellman_ford/bellman_ford.c @@ -72,9 +72,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/bellman_ford/bellman_ford_neg.c b/src/bellman_ford/bellman_ford_neg.c index 526bb08d265..10f711cc0fe 100644 --- a/src/bellman_ford/bellman_ford_neg.c +++ b/src/bellman_ford/bellman_ford_neg.c @@ -72,9 +72,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/bellman_ford/edwardMoore.c b/src/bellman_ford/edwardMoore.c index 9621c46da9b..c3a07924fd1 100644 --- a/src/bellman_ford/edwardMoore.c +++ b/src/bellman_ford/edwardMoore.c @@ -70,9 +70,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/breadthFirstSearch/binaryBreadthFirstSearch.c b/src/breadthFirstSearch/binaryBreadthFirstSearch.c index 9ad738beb22..c904907bf39 100644 --- a/src/breadthFirstSearch/binaryBreadthFirstSearch.c +++ b/src/breadthFirstSearch/binaryBreadthFirstSearch.c @@ -70,9 +70,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/breadthFirstSearch/breadthFirstSearch.c b/src/breadthFirstSearch/breadthFirstSearch.c index b52b2aeb2d4..83b4749297b 100644 --- a/src/breadthFirstSearch/breadthFirstSearch.c +++ b/src/breadthFirstSearch/breadthFirstSearch.c @@ -61,7 +61,7 @@ process( size_t size_start_vidsArr = 0; int64_t *start_vidsArr = (int64_t *) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); PGR_DBG("start_vidsArr size %ld ", size_start_vidsArr); diff --git a/src/circuits/hawickCircuits.c b/src/circuits/hawickCircuits.c index 16707907939..7d0c5c5cd09 100644 --- a/src/circuits/hawickCircuits.c +++ b/src/circuits/hawickCircuits.c @@ -54,8 +54,6 @@ PG_FUNCTION_INFO_V1(_pgr_hawickcircuits); * @param edges_sql the edges of the SQL query * @param result_tuples the rows in the result * @param result_count the count of rows in the result - * - * @returns void */ static void diff --git a/src/coloring/edgeColoring.c b/src/coloring/edgeColoring.c index c1905e24fc9..7a5d27aa23b 100644 --- a/src/coloring/edgeColoring.c +++ b/src/coloring/edgeColoring.c @@ -57,8 +57,6 @@ PG_FUNCTION_INFO_V1(_pgr_edgecoloring); * @param edges_sql the edges of the SQL query * @param result_tuples the rows in the result * @param result_count the count of rows in the result - * - * @returns void */ static diff --git a/src/coloring/sequentialVertexColoring.c b/src/coloring/sequentialVertexColoring.c index ba9c0e43a7f..aac452ba49d 100644 --- a/src/coloring/sequentialVertexColoring.c +++ b/src/coloring/sequentialVertexColoring.c @@ -59,8 +59,6 @@ PG_FUNCTION_INFO_V1(_pgr_sequentialvertexcoloring); * @param edges_sql the edges of the SQL query * @param result_tuples the rows in the result * @param result_count the count of rows in the result - * - * @returns void */ static void diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index f9f7ab72f0e..1f5386302fd 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -16,7 +16,6 @@ ADD_LIBRARY(common OBJECT restrictions_input.c coordinates_input.c - arrays_input.c delauny_input.c check_parameters.c diff --git a/src/common/get_check_data.c b/src/common/get_check_data.c index 16a6a261e4d..61c70ff330b 100644 --- a/src/common/get_check_data.c +++ b/src/common/get_check_data.c @@ -323,7 +323,7 @@ pgr_SPI_getBigIntArr( */ ArrayType *pg_array = DatumGetArrayTypeP(raw_array); - return pgr_get_bigIntArray_allowEmpty((size_t*)the_size, pg_array); + return pgr_get_bigIntArray((size_t*)the_size, pg_array, true); } /*! diff --git a/src/contraction/contractGraph.c b/src/contraction/contractGraph.c index d89941e35e4..3021e409ef8 100644 --- a/src/contraction/contractGraph.c +++ b/src/contraction/contractGraph.c @@ -68,17 +68,11 @@ process(char* edges_sql, pgr_SPI_connect(); size_t size_forbidden_vertices = 0; - int64_t* forbidden_vertices = - pgr_get_bigIntArray_allowEmpty( - &size_forbidden_vertices, - forbidden); + int64_t* forbidden_vertices = pgr_get_bigIntArray(&size_forbidden_vertices, forbidden, true); PGR_DBG("size_forbidden_vertices %ld", size_forbidden_vertices); size_t size_contraction_order = 0; - int64_t* contraction_order = - pgr_get_bigIntArray( - &size_contraction_order, - order); + int64_t* contraction_order = pgr_get_bigIntArray(&size_contraction_order, order, false); PGR_DBG("size_contraction_order %ld ", size_contraction_order); diff --git a/src/cpp_common/CMakeLists.txt b/src/cpp_common/CMakeLists.txt index 80d5d71577f..9e99f3bb826 100644 --- a/src/cpp_common/CMakeLists.txt +++ b/src/cpp_common/CMakeLists.txt @@ -5,4 +5,5 @@ ADD_LIBRARY(cpp_common OBJECT bpoint.cpp pgr_messages.cpp combinations.cpp + arrays_input.cpp ) diff --git a/src/common/arrays_input.c b/src/cpp_common/arrays_input.cpp similarity index 59% rename from src/common/arrays_input.c rename to src/cpp_common/arrays_input.cpp index d5644e944d9..2bb255ffc20 100644 --- a/src/common/arrays_input.c +++ b/src/cpp_common/arrays_input.cpp @@ -1,8 +1,9 @@ /*PGR-GNU***************************************************************** -File: arrays_input.c +File: arrays_input.cpp +Copyright (c) 2023 Celia Virginia Vergara Castillo Copyright (c) 2015 Celia Virginia Vergara Castillo -vicky_vergara@hotmail.com +mail: vicky at erosion.dev ------ @@ -24,14 +25,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. #include "c_common/arrays_input.h" -#include +extern "C" { #include #include +} -#include "c_common/time_msg.h" -#include "c_common/debug_macro.h" -/** - * Function for array input +#include "cpp_common/pgr_alloc.hpp" + +namespace { + +/** @brief get the array contents from postgres + * * @details This function generates the array inputs according to their type * received through @a ArrayType *v parameter and store them in @a c_array. It * can be empty also if received @a allow_empty true. The cases of failure are:- @@ -42,46 +46,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 5. When null value is found in the array. * * All these failures are represented as error through @a elog. - * @param[in] v The type of element to be processed. - * @param[out] arrlen The length of the array (To be determined in this function). - * @param[in] allow_empty Bool type parameter that tells us whether to consider empty - * array or not. - * @pre The initial value of @a *arrlen should be zero. - * @returns The resultant array i.e. @a c_array. + * @param[in] v Pointer to the postgres C array + * @param[out] arrlen size of the C array + * @param[in] allow_empty flag to allow empty arrays + * + * @pre the array has to be one dimension + * @pre Must have elements (when allow_empty is false) + * + * @returns The resultant array */ -static int64_t* -pgr_get_bigIntArr(ArrayType *v, size_t *arrlen, bool allow_empty) { - clock_t start_t = clock(); - int64_t *c_array = NULL; - - Oid element_type = ARR_ELEMTYPE(v); - int *dim = ARR_DIMS(v); - int ndim = ARR_NDIM(v); - int nitems = ArrayGetNItems(ndim, dim); - Datum *elements; - bool *nulls; +get_bigIntArr(ArrayType *v, size_t *arrlen, bool allow_empty) { + int64_t *c_array = nullptr; + + auto element_type = ARR_ELEMTYPE(v); + auto dim = ARR_DIMS(v); + auto ndim = ARR_NDIM(v); + auto nitems = ArrayGetNItems(ndim, dim); + Datum *elements = nullptr; + bool *nulls = nullptr; int16 typlen; bool typbyval; char typalign; - assert((*arrlen) == 0); - if (allow_empty && (ndim == 0 || nitems <= 0)) { - PGR_DBG("ndim %d nitems %d", ndim, nitems); - return (int64_t*)NULL; + return nullptr; } - /* the array is not empty*/ if (ndim != 1) { elog(ERROR, "One dimension expected"); - return (int64_t*)NULL; + return nullptr; } if (nitems <= 0) { elog(ERROR, "No elements found"); - return (int64_t*)NULL; + return nullptr; } get_typlenbyvalalign(element_type, @@ -95,7 +95,7 @@ pgr_get_bigIntArr(ArrayType *v, size_t *arrlen, bool allow_empty) { break; default: elog(ERROR, "Expected array of ANY-INTEGER"); - return (int64_t*)NULL; + return nullptr; break; } @@ -103,24 +103,23 @@ pgr_get_bigIntArr(ArrayType *v, size_t *arrlen, bool allow_empty) { typalign, &elements, &nulls, &nitems); - c_array = (int64_t *) palloc(sizeof(int64_t) * (size_t)nitems); + c_array = pgr_alloc(static_cast(nitems), (c_array)); if (!c_array) { elog(ERROR, "Out of memory!"); } - int i; - for (i = 0; i < nitems; i++) { + for (int i = 0; i < nitems; i++) { if (nulls[i]) { pfree(c_array); elog(ERROR, "NULL value found in Array!"); } else { switch (element_type) { case INT2OID: - c_array[i] = (int64_t) DatumGetInt16(elements[i]); + c_array[i] = static_cast(DatumGetInt16(elements[i])); break; case INT4OID: - c_array[i] = (int64_t) DatumGetInt32(elements[i]); + c_array[i] = static_cast(DatumGetInt32(elements[i])); break; case INT8OID: c_array[i] = DatumGetInt64(elements[i]); @@ -128,31 +127,22 @@ pgr_get_bigIntArr(ArrayType *v, size_t *arrlen, bool allow_empty) { } } } - (*arrlen) = (size_t)nitems; + (*arrlen) = static_cast(nitems); pfree(elements); pfree(nulls); - PGR_DBG("Array size %ld", (*arrlen)); - time_msg("reading Array", start_t, clock()); return c_array; } -/** - * @param[out] arrlen Length of the array - * @param[in] input Input type of the array - * @returns Returns the output of @a pgr_get_bitIntArray when @a allow_empty is set to false. - */ - -int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input) { - return pgr_get_bigIntArr(input, arrlen, false); -} +} // namespace /** * @param[out] arrlen Length of the array - * @param[in] input Input type of the array - * @returns Returns the output of @a pgr_get_bitIntArray when @a allow_empty is set to true. + * @param[in] input the postgres array + * @param[in] allow_empty when true, empty arrays are accepted. + * @returns Returns a C array of integers */ -int64_t* pgr_get_bigIntArray_allowEmpty(size_t *arrlen, ArrayType *input) { - return pgr_get_bigIntArr(input, arrlen, true); +int64_t* pgr_get_bigIntArray(size_t *arrlen, ArrayType *input, bool allow_empty) { + return get_bigIntArr(input, arrlen, allow_empty); } diff --git a/src/dagShortestPath/dagShortestPath.c b/src/dagShortestPath/dagShortestPath.c index e1264e83d3f..3edcf77fe89 100644 --- a/src/dagShortestPath/dagShortestPath.c +++ b/src/dagShortestPath/dagShortestPath.c @@ -75,9 +75,9 @@ process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/dijkstra/dijkstra.c b/src/dijkstra/dijkstra.c index f624826271b..6eca72f265a 100644 --- a/src/dijkstra/dijkstra.c +++ b/src/dijkstra/dijkstra.c @@ -77,15 +77,15 @@ process( if (normal) { pgr_get_edges(edges_sql, &edges, &total_edges, true, false); start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else { pgr_get_edges(edges_sql, &edges, &total_edges, false, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, starts); + pgr_get_bigIntArray(&size_end_vidsArr, starts, false); start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, ends); + pgr_get_bigIntArray(&size_start_vidsArr, ends, false); } if (total_edges == 0) { diff --git a/src/dijkstra/dijkstraVia.c b/src/dijkstra/dijkstraVia.c index f784dc2b6b1..b7d7946d3aa 100644 --- a/src/dijkstra/dijkstraVia.c +++ b/src/dijkstra/dijkstraVia.c @@ -51,7 +51,7 @@ process(char* edges_sql, pgr_SPI_connect(); size_t size_via_vidsArr = 0; - int64_t* via_vidsArr = (int64_t*) pgr_get_bigIntArray(&size_via_vidsArr, vias); + int64_t* via_vidsArr = (int64_t*) pgr_get_bigIntArray(&size_via_vidsArr, vias, false); Edge_t* edges = NULL; size_t total_edges = 0; diff --git a/src/driving_distance/many_to_dist_driving_distance.c b/src/driving_distance/many_to_dist_driving_distance.c index 8fee3fe539a..00fd226d4df 100644 --- a/src/driving_distance/many_to_dist_driving_distance.c +++ b/src/driving_distance/many_to_dist_driving_distance.c @@ -52,7 +52,7 @@ void process( pgr_SPI_connect(); size_t size_start_vidsArr = 0; - int64_t* start_vidsArr = pgr_get_bigIntArray(&size_start_vidsArr, starts); + int64_t* start_vidsArr = pgr_get_bigIntArray(&size_start_vidsArr, starts, false); Edge_t *edges = NULL; size_t total_tuples = 0; diff --git a/src/driving_distance/many_to_dist_withPointsDD.c b/src/driving_distance/many_to_dist_withPointsDD.c index cbe6ffd5b26..c6e2fdc7539 100644 --- a/src/driving_distance/many_to_dist_withPointsDD.c +++ b/src/driving_distance/many_to_dist_withPointsDD.c @@ -61,7 +61,7 @@ void process( pgr_SPI_connect(); size_t total_starts = 0; - int64_t* start_pidsArr = pgr_get_bigIntArray(&total_starts, starts); + int64_t* start_pidsArr = pgr_get_bigIntArray(&total_starts, starts, false); PGR_DBG("sourcesArr size %ld ", total_starts); Point_on_edge_t *points = NULL; diff --git a/src/max_flow/edge_disjoint_paths.c b/src/max_flow/edge_disjoint_paths.c index 9de041bfc0d..c6082b8472e 100644 --- a/src/max_flow/edge_disjoint_paths.c +++ b/src/max_flow/edge_disjoint_paths.c @@ -71,9 +71,9 @@ process( if (starts && ends) { source_vertices = (int64_t*) - pgr_get_bigIntArray(&size_source_verticesArr, starts); + pgr_get_bigIntArray(&size_source_verticesArr, starts, false); sink_vertices = (int64_t*) - pgr_get_bigIntArray(&size_sink_verticesArr, ends); + pgr_get_bigIntArray(&size_sink_verticesArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/max_flow/max_flow.c b/src/max_flow/max_flow.c index 8e1671b8963..9d5c9a3f92b 100644 --- a/src/max_flow/max_flow.c +++ b/src/max_flow/max_flow.c @@ -76,9 +76,9 @@ process( if (starts && ends) { source_vertices = (int64_t*) - pgr_get_bigIntArray(&size_source_verticesArr, starts); + pgr_get_bigIntArray(&size_source_verticesArr, starts, false); sink_vertices = (int64_t*) - pgr_get_bigIntArray(&size_sink_verticesArr, ends); + pgr_get_bigIntArray(&size_sink_verticesArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/max_flow/minCostMaxFlow.c b/src/max_flow/minCostMaxFlow.c index 3c57da067c6..9e999886eaa 100644 --- a/src/max_flow/minCostMaxFlow.c +++ b/src/max_flow/minCostMaxFlow.c @@ -94,9 +94,9 @@ process( if (starts && ends) { sourceVertices = (int64_t*) - pgr_get_bigIntArray(&sizeSourceVerticesArr, starts); + pgr_get_bigIntArray(&sizeSourceVerticesArr, starts, false); sinkVertices = (int64_t*) - pgr_get_bigIntArray(&sizeSinkVerticesArr, ends); + pgr_get_bigIntArray(&sizeSinkVerticesArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); if (total_combinations == 0) { diff --git a/src/ordering/cuthillMckeeOrdering.c b/src/ordering/cuthillMckeeOrdering.c index 15b62385695..b0f58808f58 100644 --- a/src/ordering/cuthillMckeeOrdering.c +++ b/src/ordering/cuthillMckeeOrdering.c @@ -57,8 +57,6 @@ PG_FUNCTION_INFO_V1(_pgr_cuthillmckeeordering); * @param edges_sql the edges of the SQL query * @param result_tuples the rows in the result * @param result_count the count of rows in the result - * - * @returns void */ static diff --git a/src/spanningTree/kruskal.c b/src/spanningTree/kruskal.c index 64cdbae1601..906ac064cc9 100644 --- a/src/spanningTree/kruskal.c +++ b/src/spanningTree/kruskal.c @@ -69,7 +69,7 @@ process( } size_t size_rootsArr = 0; - int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots); + int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots, false); (*result_tuples) = NULL; (*result_count) = 0; diff --git a/src/spanningTree/prim.c b/src/spanningTree/prim.c index 2c6add41540..fb5da78ef69 100644 --- a/src/spanningTree/prim.c +++ b/src/spanningTree/prim.c @@ -68,7 +68,7 @@ process( } size_t size_rootsArr = 0; - int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots); + int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots, false); (*result_tuples) = NULL; (*result_count) = 0; diff --git a/src/traversal/depthFirstSearch.c b/src/traversal/depthFirstSearch.c index 55765c4bcf0..41c9e1f7bba 100644 --- a/src/traversal/depthFirstSearch.c +++ b/src/traversal/depthFirstSearch.c @@ -63,8 +63,6 @@ PG_FUNCTION_INFO_V1(_pgr_depthfirstsearch); * @param max_depth the maximum depth of traversal * @param result_tuples the rows in the result * @param result_count the count of rows in the result - * - * @returns void */ static void @@ -80,7 +78,7 @@ process( size_t size_rootsArr = 0; - int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots); + int64_t* rootsArr = (int64_t*) pgr_get_bigIntArray(&size_rootsArr, roots, false); (*result_tuples) = NULL; (*result_count) = 0; diff --git a/src/trsp/new_trsp.c b/src/trsp/new_trsp.c index 6b180d824ee..0bff301c7fa 100644 --- a/src/trsp/new_trsp.c +++ b/src/trsp/new_trsp.c @@ -91,9 +91,9 @@ void process( if (starts && ends) { start_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_vidsArr, starts); + pgr_get_bigIntArray(&size_start_vidsArr, starts, false); end_vidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_vidsArr, ends); + pgr_get_bigIntArray(&size_end_vidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } diff --git a/src/trsp/trspVia.c b/src/trsp/trspVia.c index e2d1eaa5dd6..d1d92a88a53 100644 --- a/src/trsp/trspVia.c +++ b/src/trsp/trspVia.c @@ -50,7 +50,7 @@ process( pgr_SPI_connect(); size_t size_via = 0; - int64_t* via = (int64_t*) pgr_get_bigIntArray(&size_via, via_arr); + int64_t* via = (int64_t*) pgr_get_bigIntArray(&size_via, via_arr, false); Edge_t* edges = NULL; size_t size_edges = 0; diff --git a/src/trsp/trspVia_withPoints.c b/src/trsp/trspVia_withPoints.c index 4dbb10a6676..71a97188709 100644 --- a/src/trsp/trspVia_withPoints.c +++ b/src/trsp/trspVia_withPoints.c @@ -60,7 +60,7 @@ process( * Processing Via */ size_t size_via = 0; - int64_t* via = (int64_t*) pgr_get_bigIntArray(&size_via, viasArr); + int64_t* via = (int64_t*) pgr_get_bigIntArray(&size_via, viasArr, false); // TODO(vicky) figure out what happens when one point or 0 points are given diff --git a/src/trsp/trsp_withPoints.c b/src/trsp/trsp_withPoints.c index e7aa120cc42..fb4fe1c08d2 100644 --- a/src/trsp/trsp_withPoints.c +++ b/src/trsp/trsp_withPoints.c @@ -111,8 +111,8 @@ process( /* Managing departure & destination */ if (starts && ends) { - start_pidsArr = (int64_t*) pgr_get_bigIntArray(&size_start_pidsArr, starts); - end_pidsArr = (int64_t*) pgr_get_bigIntArray(&size_end_pidsArr, ends); + start_pidsArr = (int64_t*) pgr_get_bigIntArray(&size_start_pidsArr, starts, false); + end_pidsArr = (int64_t*) pgr_get_bigIntArray(&size_end_pidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } diff --git a/src/withPoints/withPoints.c b/src/withPoints/withPoints.c index 67c0fbac48f..b01e4b1554c 100644 --- a/src/withPoints/withPoints.c +++ b/src/withPoints/withPoints.c @@ -107,9 +107,9 @@ process( if (starts && ends) { start_pidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_pidsArr, starts); + pgr_get_bigIntArray(&size_start_pidsArr, starts, false); end_pidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_pidsArr, ends); + pgr_get_bigIntArray(&size_end_pidsArr, ends, false); } else if (combinations_sql) { pgr_get_combinations(combinations_sql, &combinations, &total_combinations); } @@ -118,9 +118,9 @@ process( pgr_get_edges(edges_no_points_query, &edges, &total_edges, false, false); end_pidsArr = (int64_t*) - pgr_get_bigIntArray(&size_end_pidsArr, starts); + pgr_get_bigIntArray(&size_end_pidsArr, starts, false); start_pidsArr = (int64_t*) - pgr_get_bigIntArray(&size_start_pidsArr, ends); + pgr_get_bigIntArray(&size_start_pidsArr, ends, false); } diff --git a/src/withPoints/withPointsVia.c b/src/withPoints/withPointsVia.c index ff582fc811a..98e070f5db4 100644 --- a/src/withPoints/withPointsVia.c +++ b/src/withPoints/withPointsVia.c @@ -58,7 +58,7 @@ process( * Processing Via */ size_t size_vias = 0; - int64_t* vias = (int64_t*) pgr_get_bigIntArray(&size_vias, viasArr); + int64_t* vias = (int64_t*) pgr_get_bigIntArray(&size_vias, viasArr, false); // TODO(vicky) figure out what happens when one point or 0 points are given