-
-
Notifications
You must be signed in to change notification settings - Fork 376
Using const char on drivers #2871
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using const char on drivers #2871
Conversation
WalkthroughThis change updates the signatures of numerous C++ driver functions and related code in the pgRouting project to use Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant DriverFunction
Note over Caller,DriverFunction: Example: pgr_do_astar, pgr_do_dijkstra, etc.
Caller->>DriverFunction: Call with const char* sql_query
DriverFunction->>DriverFunction: Uses sql_query (read-only)
DriverFunction-->>Caller: Returns result (does not modify sql_query)
Assessment against linked issues
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (1)
src/bellman_ford/bellman_ford_neg_driver.cpp (1)
119-119
:⚠️ Potential issuePotential logic error (unrelated to PR changes)
There appears to be a logic error in the condition
edges.size() + neg_edges.empty()
. This adds a size to a boolean value, which may not behave as intended. The condition likely should be checking if both edge collections are empty.- if (edges.size() + neg_edges.empty()) { + if (edges.empty() && neg_edges.empty()) {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (107)
NEWS.md
(1 hunks)doc/src/release_notes.rst
(1 hunks)include/cpp_common/combinations.hpp
(1 hunks)include/drivers/allpairs/floydWarshall_driver.h
(1 hunks)include/drivers/allpairs/johnson_driver.h
(1 hunks)include/drivers/alpha_shape/alphaShape_driver.h
(1 hunks)include/drivers/astar/astar_driver.h
(1 hunks)include/drivers/bdAstar/bdAstar_driver.h
(1 hunks)include/drivers/bdDijkstra/bdDijkstra_driver.h
(1 hunks)include/drivers/bellman_ford/bellman_ford_driver.h
(1 hunks)include/drivers/bellman_ford/bellman_ford_neg_driver.h
(1 hunks)include/drivers/bellman_ford/edwardMoore_driver.h
(1 hunks)include/drivers/breadthFirstSearch/binaryBreadthFirstSearch_driver.h
(1 hunks)include/drivers/breadthFirstSearch/breadthFirstSearch_driver.h
(1 hunks)include/drivers/chinese/chinesePostman_driver.h
(1 hunks)include/drivers/circuits/hawickCircuits_driver.h
(1 hunks)include/drivers/coloring/bipartite_driver.h
(1 hunks)include/drivers/coloring/edgeColoring_driver.h
(1 hunks)include/drivers/coloring/sequentialVertexColoring_driver.h
(1 hunks)include/drivers/components/articulationPoints_driver.h
(1 hunks)include/drivers/components/biconnectedComponents_driver.h
(1 hunks)include/drivers/components/bridges_driver.h
(1 hunks)include/drivers/components/connectedComponents_driver.h
(1 hunks)include/drivers/components/makeConnected_driver.h
(1 hunks)include/drivers/components/strongComponents_driver.h
(1 hunks)include/drivers/contraction/contractGraph_driver.h
(1 hunks)include/drivers/contraction/contractionHierarchies_driver.h
(1 hunks)include/drivers/dagShortestPath/dagShortestPath_driver.h
(1 hunks)include/drivers/dijkstra/dijkstraVia_driver.h
(1 hunks)include/drivers/dijkstra/dijkstra_driver.h
(1 hunks)include/drivers/dominator/lengauerTarjanDominatorTree_driver.h
(1 hunks)include/drivers/driving_distance/driving_distance_driver.h
(1 hunks)include/drivers/driving_distance/driving_distance_withPoints_driver.h
(1 hunks)include/drivers/lineGraph/lineGraphFull_driver.h
(1 hunks)include/drivers/lineGraph/lineGraph_driver.h
(1 hunks)include/drivers/max_flow/edge_disjoint_paths_driver.h
(1 hunks)include/drivers/max_flow/max_flow_driver.h
(1 hunks)include/drivers/max_flow/maximum_cardinality_matching_driver.h
(1 hunks)include/drivers/max_flow/minCostMaxFlow_driver.h
(1 hunks)include/drivers/metrics/betweennessCentrality_driver.h
(1 hunks)include/drivers/mincut/stoerWagner_driver.h
(1 hunks)include/drivers/ordering/cuthillMckeeOrdering_driver.h
(1 hunks)include/drivers/pickDeliver/pickDeliverEuclidean_driver.h
(1 hunks)include/drivers/pickDeliver/pickDeliver_driver.h
(1 hunks)include/drivers/planar/boyerMyrvold_driver.h
(1 hunks)include/drivers/planar/isPlanar_driver.h
(1 hunks)include/drivers/spanningTree/kruskal_driver.h
(1 hunks)include/drivers/spanningTree/prim_driver.h
(1 hunks)include/drivers/spanningTree/randomSpanningTree_driver.h
(1 hunks)include/drivers/topologicalSort/topologicalSort_driver.h
(1 hunks)include/drivers/transitiveClosure/transitiveClosure_driver.h
(1 hunks)include/drivers/traversal/depthFirstSearch_driver.h
(1 hunks)include/drivers/trsp/trspVia_driver.h
(1 hunks)include/drivers/trsp/trspVia_withPoints_driver.h
(1 hunks)include/drivers/trsp/trsp_driver.h
(1 hunks)include/drivers/trsp/trsp_withPoints_driver.h
(1 hunks)include/drivers/tsp/TSP_driver.h
(1 hunks)include/drivers/tsp/euclideanTSP_driver.h
(1 hunks)include/drivers/withPoints/withPointsVia_driver.h
(1 hunks)include/drivers/withPoints/withPoints_driver.h
(1 hunks)include/drivers/yen/ksp_driver.h
(1 hunks)include/drivers/yen/turnRestrictedPath_driver.h
(1 hunks)include/drivers/yen/withPoints_ksp_driver.h
(1 hunks)locale/en/LC_MESSAGES/pgrouting_doc_strings.po
(2 hunks)locale/pot/pgrouting_doc_strings.pot
(2 hunks)src/allpairs/floydWarshall_driver.cpp
(2 hunks)src/allpairs/johnson_driver.cpp
(2 hunks)src/alpha_shape/alphaShape_driver.cpp
(2 hunks)src/astar/astar_driver.cpp
(2 hunks)src/bdAstar/bdAstar_driver.cpp
(2 hunks)src/bdDijkstra/bdDijkstra_driver.cpp
(2 hunks)src/bellman_ford/bellman_ford_driver.cpp
(2 hunks)src/bellman_ford/bellman_ford_neg_driver.cpp
(2 hunks)src/bellman_ford/edwardMoore_driver.cpp
(2 hunks)src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp
(2 hunks)src/breadthFirstSearch/breadthFirstSearch_driver.cpp
(2 hunks)src/chinese/chinesePostman_driver.cpp
(2 hunks)src/circuits/hawickCircuits_driver.cpp
(2 hunks)src/coloring/bipartite_driver.cpp
(2 hunks)src/coloring/edgeColoring_driver.cpp
(2 hunks)src/coloring/sequentialVertexColoring_driver.cpp
(2 hunks)src/components/articulationPoints_driver.cpp
(2 hunks)src/components/biconnectedComponents_driver.cpp
(2 hunks)src/components/bridges_driver.cpp
(2 hunks)src/components/connectedComponents_driver.cpp
(2 hunks)src/components/makeConnected_driver.cpp
(2 hunks)src/components/strongComponents_driver.cpp
(2 hunks)src/contraction/contractGraph_driver.cpp
(2 hunks)src/contraction/contractionHierarchies_driver.cpp
(2 hunks)src/cpp_common/combinations.cpp
(1 hunks)src/dagShortestPath/dagShortestPath_driver.cpp
(2 hunks)src/dijkstra/dijkstraVia_driver.cpp
(2 hunks)src/dijkstra/dijkstra_driver.cpp
(2 hunks)src/dominator/lengauerTarjanDominatorTree_driver.cpp
(2 hunks)src/driving_distance/driving_distance_driver.cpp
(2 hunks)src/driving_distance/driving_distance_withPoints_driver.cpp
(2 hunks)src/ksp/ksp_driver.cpp
(2 hunks)src/ksp/turnRestrictedPath_driver.cpp
(2 hunks)src/ksp/withPoints_ksp_driver.cpp
(2 hunks)src/lineGraph/lineGraphFull_driver.cpp
(2 hunks)src/lineGraph/lineGraph_driver.cpp
(2 hunks)src/max_flow/edge_disjoint_paths_driver.cpp
(2 hunks)src/max_flow/max_flow_driver.cpp
(3 hunks)src/max_flow/maximum_cardinality_matching_driver.cpp
(2 hunks)src/max_flow/minCostMaxFlow_driver.cpp
(2 hunks)src/metrics/betweennessCentrality_driver.cpp
(2 hunks)src/mincut/stoerWagner_driver.cpp
(2 hunks)
⛔ Files not processed due to max files limit (21)
- src/ordering/cuthillMckeeOrdering_driver.cpp
- src/pickDeliver/pickDeliver.c
- src/pickDeliver/pickDeliverEuclidean_driver.cpp
- src/pickDeliver/pickDeliver_driver.cpp
- src/planar/boyerMyrvold_driver.cpp
- src/planar/isPlanar_driver.cpp
- src/spanningTree/kruskal_driver.cpp
- src/spanningTree/prim.c
- src/spanningTree/prim_driver.cpp
- src/spanningTree/randomSpanningTree_driver.cpp
- src/topologicalSort/topologicalSort_driver.cpp
- src/transitiveClosure/transitiveClosure_driver.cpp
- src/traversal/depthFirstSearch_driver.cpp
- src/trsp/trspVia_driver.cpp
- src/trsp/trspVia_withPoints_driver.cpp
- src/trsp/trsp_driver.cpp
- src/trsp/trsp_withPoints_driver.cpp
- src/tsp/TSP_driver.cpp
- src/tsp/euclideanTSP_driver.cpp
- src/withPoints/withPointsVia_driver.cpp
- src/withPoints/withPoints_driver.cpp
👮 Files not reviewed due to content moderation or server errors (1)
- locale/en/LC_MESSAGES/pgrouting_doc_strings.po
🧰 Additional context used
🧠 Learnings (1)
include/drivers/contraction/contractionHierarchies_driver.h (1)
Learnt from: cvvergara
PR: pgRouting/pgrouting#2868
File: src/contraction/contractionHierarchies_driver.cpp:47-56
Timestamp: 2025-04-25T00:59:52.550Z
Learning: In pgRouting, driver functions like `pgr_contractionHierarchies` assume that callers within the project will pass valid non-null pointers, as these functions are only used internally with well-defined call patterns. Null checks on the pointers themselves (as opposed to their dereferenced values) are considered unnecessary since the caller is guaranteed to pass references to variables.
🧬 Code Graph Analysis (1)
src/max_flow/max_flow_driver.cpp (2)
include/cpp_common/alloc.hpp (2)
to_pg_msg
(90-90)to_pg_msg
(91-91)src/common/alloc.cpp (4)
to_pg_msg
(34-42)to_pg_msg
(35-35)to_pg_msg
(44-47)to_pg_msg
(45-45)
⏰ Context from checks skipped due to timeout of 90000ms (15)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Ubuntu clang
- GitHub Check: macos (macos-14)
- GitHub Check: Check queries
- GitHub Check: Check for changelog entry
- GitHub Check: Ubuntu Boost (83)
- GitHub Check: Ubuntu Boost (75)
- GitHub Check: Ubuntu Boost (79)
- GitHub Check: Ubuntu Boost (86)
- GitHub Check: Ubuntu Boost (56)
- GitHub Check: Ubuntu Boost (78)
- GitHub Check: Ubuntu Boost (77)
- GitHub Check: Ubuntu Boost (76)
- GitHub Check: Ubuntu Boost (84)
- GitHub Check: Ubuntu Boost (68)
🔇 Additional comments (144)
include/drivers/planar/boyerMyrvold_driver.h (1)
46-46
: Great improvement to const-correctness!Changing the function parameter from
char*
toconst char*
is a solid improvement that explicitly indicates this SQL query string is not modified within the function. This enforces const-correctness, which improves code safety and makes the API intent clearer to users.include/drivers/pickDeliver/pickDeliver_driver.h (1)
49-51
: Excellent use of const-correctnessThe change from
char*
toconst char*
for the SQL query string parameters is a good improvement. This enforces that these input parameters won't be modified by the function, which:
- Prevents unintended modification of input strings
- Makes the API intent clearer
- Potentially enables compiler optimizations
- Aligns with modern C++ best practices
include/drivers/pickDeliver/pickDeliverEuclidean_driver.h (1)
49-50
: Good implementation of const-correctnessThe change from
char*
toconst char*
for these input SQL query string parameters is appropriate and consistent with the changes in other driver files. This properly enforces immutability of input strings and improves the safety of the API.include/drivers/tsp/TSP_driver.h (1)
53-53
: Approve change to const char*Changing the parameter type from
char*
toconst char*
improves const-correctness, ensuring that the SQL query string passed to this function cannot be modified within the function. This is good practice in C++ and aligns with the PR objective of improving code safety.include/drivers/tsp/euclideanTSP_driver.h (1)
52-52
: Approve change to const char*This change from
char*
toconst char*
enforces immutability of the input SQL query string, improving const-correctness. This is consistent with modern C++ best practices and matches the pattern applied across other drivers in this PR. The change helps prevent unintended modification of input parameters.include/drivers/transitiveClosure/transitiveClosure_driver.h (1)
45-47
: Enforce const-correctness on SQL input parameter
The change fromchar*
toconst char*
for the first parameter correctly prevents modification of the input SQL string withinpgr_do_transitiveClosure
. This aligns with the PR objective to improve const-correctness across driver APIs.include/drivers/ordering/cuthillMckeeOrdering_driver.h (1)
53-53
: Parameter type change to enforce const-correctness.The change from
char*
toconst char*
properly enforces that the SQL query string won't be modified within the function implementation, which is good practice for parameters that should be treated as immutable input.include/drivers/max_flow/max_flow_driver.h (1)
62-63
: Parameter types changed to enforce const-correctness.Changing both SQL string parameters from
char*
toconst char*
properly enforces that the SQL query strings won't be modified within the function implementation. This enhances type safety and communicates the intended immutability of these parameters.NEWS.md (1)
71-72
: Documentation updated to reference const-correctness enhancements.The NEWS file has been appropriately updated to document the const-correctness improvements, making reference to issue #2869. This properly informs users about the code enhancements in the 3.8.0 release.
doc/src/release_notes.rst (1)
100-101
: Good addition to release notes.The addition of issue #2869 to the C/C++ code enhancements section properly documents the const-correctness improvements being made in this PR.
include/cpp_common/combinations.hpp (1)
70-70
: Proper use of const to enforce immutability.Changing the parameter from
char*
toconst char*
correctly indicates that the function won't modify the SQL string passed to it. This improves type safety and makes the interface more expressive about its intentions.include/drivers/allpairs/johnson_driver.h (1)
51-51
: Good const-correctness improvement.The modification of the parameter from
char*
toconst char*
enhances code safety by properly indicating that the input SQL string won't be modified within the function. This is a beneficial change that aligns with good C++ practices.locale/pot/pgrouting_doc_strings.pot (2)
11-11
: Updated timestamp for translation template.The POT-Creation-Date has been updated to reflect when this translation template was regenerated.
3604-3606
: New documentation entry for enhancement from PR.This new entry adds documentation for issue #2869 under the "Other enhancements" section, which corresponds to the const char* modifications in driver code as mentioned in the PR objectives.
include/drivers/components/bridges_driver.h (1)
49-49
: Good change: Improved const correctnessChanging the SQL query parameter from
char*
toconst char*
properly enforces that the input string won't be modified by the function. This improves type safety and makes the function's behavior more explicit.include/drivers/coloring/bipartite_driver.h (1)
50-50
: LGTM: Proper const qualification for SQL stringChanging the parameter type to
const char*
correctly indicates that the SQL query string is only read from and not modified within the function, following good C++ practices.include/drivers/coloring/edgeColoring_driver.h (1)
48-48
: Approved: Appropriate const correctnessGood change - adding
const
to the SQL string parameter type properly communicates to callers that this function won't modify the string passed to it.include/drivers/allpairs/floydWarshall_driver.h (1)
52-52
: Good improvement for const correctnessThis change correctly applies const-qualification to the SQL query string parameter, ensuring immutability and preventing accidental modification of the input string.
include/drivers/components/makeConnected_driver.h (1)
48-48
: Great improvement to const correctness!Changing the parameter type from
char*
toconst char*
correctly enforces that this SQL query string won't be modified within the function implementation. This is an excellent practice that improves code safety and helps prevent accidental modification of input data.include/drivers/mincut/stoerWagner_driver.h (1)
49-49
: Correctly enforcing const-correctnessThe change from
char*
toconst char*
properly indicates that the SQL query string is not modified within the function, which aligns with best practices for handling string input parameters in C++. This improvement enhances code quality and helps prevent unintended modifications.include/drivers/topologicalSort/topologicalSort_driver.h (1)
47-47
: Good use of const for immutable inputsChanging to
const char*
correctly indicates that this SQL string parameter won't be modified by the function. This is a proper implementation of const-correctness and follows modern C++ best practices for API design.include/drivers/components/strongComponents_driver.h (1)
48-48
: Appropriate use of const qualifierProper modification from
char*
toconst char*
for the SQL query string parameter. This change maintains consistency with the other driver header files and correctly enforces that the input string won't be modified, improving both code safety and readability.include/drivers/lineGraph/lineGraphFull_driver.h (1)
48-48
: Positive improvement to function signature to enforce const-correctnessChanging the parameter type from
char*
toconst char*
is a good practice that ensures the SQL query string won't be modified within the function. This improves type safety and documents the intent clearly.include/drivers/components/connectedComponents_driver.h (1)
48-48
: Well-implemented const-correctness improvementThis change from
char*
toconst char*
for the SQL query parameter properly enforces that the string won't be modified by the function, which aligns with the PR's objective of improving code safety.include/drivers/components/articulationPoints_driver.h (1)
51-51
: Good change to enforce immutability of input stringConverting this parameter from
char*
toconst char*
is appropriate since SQL query strings shouldn't be modified by the function. This change is consistent with modern C++ best practices.include/drivers/spanningTree/kruskal_driver.h (1)
62-62
: Properly implemented const-correctness for multiple parametersThe change from
char*
toconst char*
for both the SQL query parameter (line 62) and the third parameter (line 65) correctly enforces immutability for these string inputs, enhancing type safety and API clarity.Also applies to: 65-65
include/drivers/metrics/betweennessCentrality_driver.h (1)
52-52
: Good change for const-correctnessChanging the first parameter type from
char*
toconst char*
improves type safety by explicitly indicating that the input SQL string parameter won't be modified within the function. This follows best practices for const-correctness in C++.include/drivers/circuits/hawickCircuits_driver.h (1)
48-48
: Good change for const-correctnessChanging the first parameter type from
char*
toconst char*
improves type safety by explicitly indicating that the input SQL string parameter won't be modified within the function. This follows best practices for const-correctness in C++.include/drivers/chinese/chinesePostman_driver.h (1)
49-49
: Good change for const-correctnessChanging the first parameter type from
char*
toconst char*
improves type safety by explicitly indicating that the input SQL string parameter won't be modified within the function. This follows best practices for const-correctness in C++.include/drivers/alpha_shape/alphaShape_driver.h (1)
42-42
: Good change for const-correctnessChanging the first parameter type from
char*
toconst char*
improves type safety by explicitly indicating that the input SQL string parameter won't be modified within the function. This follows best practices for const-correctness in C++.include/drivers/planar/isPlanar_driver.h (1)
42-42
: Good improvement to const-correctness!Changing the parameter type from
char*
toconst char*
ensures that the SQL string passed topgr_do_isPlanar
cannot be modified within the function, which is the correct behavior since SQL query strings should typically be read-only inputs.include/drivers/lineGraph/lineGraph_driver.h (1)
50-50
: Well-implemented const-correctness enhancementThis change correctly updates the first parameter to
const char*
, indicating that the SQL query string passed topgr_do_lineGraph
will not be modified by the function. This is a good practice for parameters that should be treated as read-only inputs.include/drivers/dominator/lengauerTarjanDominatorTree_driver.h (1)
51-51
: Appropriate const-correctness implementationConverting the SQL query parameter to
const char*
is the right approach here. This makes the intention clear that the input string should not be modified within the function implementation, which aligns with best practices for treating SQL queries as immutable inputs.include/drivers/dijkstra/dijkstraVia_driver.h (1)
62-62
: Correctly implemented const-correctnessChanging the parameter type to
const char*
properly enforces that the SQL query string will be treated as read-only, which is the expected behavior for such inputs. This change improves type safety and makes the function's intent clearer to callers.include/drivers/coloring/sequentialVertexColoring_driver.h (1)
47-49
: Excellent improvement to const-correctness!Changing the parameter type from
char*
toconst char*
is appropriate since SQL query strings shouldn't be modified by the function. This promotes safer code, allows direct passing of string literals, and clearly communicates API contract.include/drivers/components/biconnectedComponents_driver.h (1)
50-52
: Good consistent application of const-correctness!Changing the first parameter from
char*
toconst char*
is the right approach for immutable SQL query strings. This change maintains consistency with other driver functions and prevents accidental modification of input strings.include/drivers/spanningTree/prim_driver.h (1)
62-67
: Appropriate const-correctness applied to both string parameters!The changes from
char*
toconst char*
for both string parameters (lines 63 and 66) are good improvements. This ensures that neither the SQL query string nor the other string parameter can be accidentally modified within the function implementation.include/drivers/contraction/contractGraph_driver.h (1)
61-63
: Well-implemented const-correctness!Changing the SQL query string parameter from
char*
toconst char*
is appropriate and consistent with the pattern applied throughout the codebase. This enhances code safety by preventing unintended modification of the input string.include/drivers/spanningTree/randomSpanningTree_driver.h (1)
61-61
: Appropriate const-correctness improvementConverting the SQL query parameter from
char*
toconst char*
properly enforces that the function won't modify the input string. This is a good practice that enhances type safety and makes the API contract clearer.include/drivers/driving_distance/driving_distance_driver.h (1)
61-61
: Sound const-correctness improvementConverting the SQL query parameter from
char*
toconst char*
correctly enforces that the function won't modify the input string. This enhances type safety and clarifies the function's contract with the caller.include/drivers/breadthFirstSearch/breadthFirstSearch_driver.h (1)
64-64
: Proper const-correctness improvementConverting the SQL query parameter from
char*
toconst char*
is an appropriate change that enforces immutability of the input string. This improves code safety and makes the function's interface more precise.include/drivers/bdDijkstra/bdDijkstra_driver.h (1)
63-64
: Well-implemented const-correctness for multiple parametersConverting both SQL query parameters from
char*
toconst char*
properly enforces that these input strings won't be modified. This is consistent with good C++ practices and improves the API safety.include/drivers/trsp/trsp_driver.h (1)
63-66
: Appropriate use of const correctness for input SQL parametersThe change from
char*
toconst char*
for the first three parameters is a good improvement. This correctly enforces that these SQL query strings are read-only within the function, preventing accidental modifications and following best practices for const correctness in C/C++ programming.include/drivers/max_flow/maximum_cardinality_matching_driver.h (1)
47-48
: Appropriate const correctness for SQL query parameterThe change from
char*
toconst char*
for the SQL query parameter properly indicates that this string won't be modified within the function. This improves type safety and follows good C/C++ programming practices for const correctness.include/drivers/traversal/depthFirstSearch_driver.h (1)
63-64
: Proper const correctness applied to SQL query parameterThe modification from
char*
toconst char*
for the first parameter is appropriate. This enforces that the SQL query string won't be modified within the function, which follows good programming practices and improves code safety.include/drivers/bellman_ford/bellman_ford_driver.h (1)
62-64
: Correctly applied const correctness to SQL query parametersThe change from
char*
toconst char*
for the first two parameters is appropriate. This ensures that these SQL query strings are treated as read-only inputs within the function implementation, preventing unintended modifications and adhering to const correctness principles.include/drivers/trsp/trspVia_driver.h (1)
60-61
: Excellent const correctness improvementThe change from
char*
toconst char*
for SQL query strings is a welcome improvement, ensuring the function doesn't modify these input parameters and signaling this intent to callers.include/drivers/bellman_ford/edwardMoore_driver.h (1)
62-63
: Proper const correctness for SQL parametersConverting the SQL query string parameters from
char*
toconst char*
is a good practice that enforces immutability of these inputs.include/drivers/max_flow/edge_disjoint_paths_driver.h (1)
63-64
: Good const-correctness for SQL stringsChanging the SQL query parameters from
char*
toconst char*
properly indicates these strings won't be modified within the function, improving type safety.include/drivers/contraction/contractionHierarchies_driver.h (1)
61-61
: Appropriate const-correctness for SQL parameterConverting the SQL query string from
char*
toconst char*
properly enforces immutability of this input parameter. This change aligns with the pattern seen across the codebase in this PR.include/drivers/max_flow/minCostMaxFlow_driver.h (1)
64-65
: Parameter types correctly changed toconst char*
Good change! Modifying these parameters from
char*
toconst char*
improves const-correctness by explicitly indicating that the SQL query strings are not modified within the function. This is a best practice in C++ that makes the code safer and more self-documenting.include/drivers/bdAstar/bdAstar_driver.h (1)
62-63
: Appropriate use ofconst char*
for SQL parametersGood job changing these parameters from
char*
toconst char*
. This enforces const-correctness by making it clear that the SQL query strings are read-only inputs that won't be modified by the function. This change matches the PR's objective of improving code safety.include/drivers/yen/ksp_driver.h (1)
63-64
: Correctly implemented const-correctness for SQL parametersGood improvement! Changing these parameters from
char*
toconst char*
aligns with best practices in C++ by explicitly indicating that the SQL query strings are immutable inputs. This makes the function signature more accurate and prevents potential modification of the input strings.include/drivers/dagShortestPath/dagShortestPath_driver.h (1)
64-65
: Proper implementation of const-correctnessExcellent change! Using
const char*
instead ofchar*
for these SQL query parameters enforces immutability of the input strings, which is the correct approach when the function does not need to modify the inputs. This improves type safety and aligns with modern C++ best practices.src/allpairs/floydWarshall_driver.cpp (2)
45-45
: Good improvement to const-correctness for SQL parameterChanging
edges_sql
fromchar*
toconst char*
is an appropriate enhancement since the function doesn't modify the SQL string. This enforces immutability and improves type safety.
57-57
: Consistent update to maintain const-correctnessUpdating the
hint
variable toconst char*
aligns with the parameter change and maintains consistent const-correctness throughout the function.include/drivers/dijkstra/dijkstra_driver.h (1)
68-69
: Appropriate const-correctness improvements in function declarationChanging both SQL string parameters to
const char*
properly reflects that these input strings shouldn't be modified by the function. This is a good practice that enforces immutability in the function interface.include/drivers/astar/astar_driver.h (1)
62-63
: Good const-correctness enhancement for SQL parametersChanging both SQL string parameters to
const char*
is appropriate since these are input-only parameters that shouldn't be modified. This change aligns with the project-wide initiative to improve const-correctness in driver interfaces.src/cpp_common/combinations.cpp (1)
138-138
: Appropriate const qualifier for combinations_sql parameterThe addition of
const
to thecombinations_sql
parameter correctly enforces that this input string won't be modified. The parameter is only used for reading in line 154, so this change improves type safety without affecting functionality.include/drivers/withPoints/withPointsVia_driver.h (1)
63-65
: Good improvement to const-correctnessChanging these parameter types from
char*
toconst char*
is a positive enhancement that ensures the SQL query strings cannot be modified within the function. This improves type safety and makes the API more explicit about its intentions.include/drivers/breadthFirstSearch/binaryBreadthFirstSearch_driver.h (1)
63-64
: Correctly enforcing immutability of input parametersThe change from
char*
toconst char*
correctly enforces that these SQL query strings are treated as read-only within the function implementation. This is consistent with best practices for API design and prevents accidental modification of input strings.include/drivers/yen/turnRestrictedPath_driver.h (1)
52-53
: Proper use of const for input-only parametersGood change to mark these SQL string parameters as
const char*
. This clarifies the interface by indicating that these strings are not modified by the function, improving type safety without affecting functionality.include/drivers/driving_distance/driving_distance_withPoints_driver.h (1)
65-67
: Appropriate const-correctness improvementUpdating these parameters to
const char*
correctly enforces that the SQL strings are not modified by the function. This change is consistent with the pattern applied throughout the codebase and follows good C++ practices for parameter passing.src/components/articulationPoints_driver.cpp (2)
47-47
: Good change for const-correctness.Changing
edges_sql
fromchar*
toconst char*
correctly indicates that this function doesn't modify the input SQL string. This improves type safety and makes the function's intent clearer.
62-62
: Appropriate matching type update.Updating the
hint
variable fromchar*
toconst char*
maintains type consistency with the now-const parameter. Sincehint
only stores a reference for error reporting and is never modified, this is the correct approach.include/drivers/trsp/trsp_withPoints_driver.h (1)
61-65
: Good const-correctness improvements for function signature.Changing all five SQL string parameters from
char*
toconst char*
properly enforces immutability for these input arguments. This better communicates that these strings are inputs only and won't be modified by the function.src/lineGraph/lineGraph_driver.cpp (2)
59-59
: Good const-correctness update for input parameter.Changing
edges_sql
fromchar*
toconst char*
correctly indicates that this function treats the SQL string as immutable input. This improves type safety and aligns with modern C++ best practices.
74-74
: Appropriate matching type update for internal variable.Updating the
hint
variable toconst char*
maintains consistency with the parameter type. Since it's only used to store the SQL string for error reporting, marking it as const is the correct approach.include/drivers/withPoints/withPoints_driver.h (1)
62-65
: Good const-correctness improvements for function interface.Changing all four SQL string parameters from
char*
toconst char*
properly enforces immutability for these input strings. This makes the function interface clearer and safer by preventing accidental modification of input data.include/drivers/yen/withPoints_ksp_driver.h (1)
66-69
: Improved const-correctness in function signature.The conversion of the first four parameters from
char*
toconst char*
is a good practice. This change explicitly indicates that these SQL query string parameters are not modified within the function, which enhances type safety and provides better guarantees to callers.src/components/strongComponents_driver.cpp (2)
48-48
: Good change to const-correctness for input parameter.Converting
edges_sql
toconst char*
is appropriate since this parameter represents an SQL query string that shouldn't be modified by the function.
63-63
: Consistent update of hint variable to match parameter type.Correctly updated the
hint
variable fromchar*
toconst char*
to maintain type consistency with the parameter it references.include/drivers/bellman_ford/bellman_ford_neg_driver.h (1)
62-64
: Improved const-correctness in function signature.The conversion of the first three parameters from
char*
toconst char*
is appropriate as these represent SQL query strings that shouldn't be modified by the function.include/drivers/trsp/trspVia_withPoints_driver.h (1)
63-66
: Enhanced const-correctness for input SQL parameters.Converting the first four parameters from
char*
toconst char*
is a good practice since these SQL query strings shouldn't be modified by the function.src/metrics/betweennessCentrality_driver.cpp (2)
44-44
: Good use of const-correctness on input parameterThe change from
char*
toconst char*
for theedges_sql
parameter appropriately enforces that the SQL query string should not be modified within the function, improving type safety.
56-56
: Appropriate const declaration for hint variableChanging the
hint
variable fromchar*
toconst char*
maintains type consistency with the input parameter and properly reflects that this is an immutable pointer to string data.src/coloring/sequentialVertexColoring_driver.cpp (2)
59-59
: Good use of const-correctness on input parameterThe change from
char*
toconst char*
for theedges_sql
parameter correctly reflects that this SQL string should not be modified within the function, improving type safety.
74-74
: Appropriate const declaration for hint variableChanging the
hint
variable fromchar*
toconst char*
maintains type consistency with the input parameter and properly reflects that this is an immutable pointer to string data.src/max_flow/maximum_cardinality_matching_driver.cpp (2)
50-50
: Good use of const-correctness on input parameterThe change from
char*
toconst char*
for theedges_sql
parameter correctly enforces that this SQL string should not be modified within the function.
67-67
: Appropriate const declaration for hint variableChanging the
hint
variable fromchar*
toconst char*
maintains type consistency with the input parameter and properly reflects that this is an immutable pointer to string data.src/mincut/stoerWagner_driver.cpp (2)
56-56
: Good use of const-correctness on input parameterThe change from
char*
toconst char*
for theedges_sql
parameter appropriately enforces that the SQL query string should not be modified within the function, improving type safety.
70-70
: Appropriate const declaration for hint variableChanging the
hint
variable fromchar*
toconst char*
maintains type consistency with the input parameter and properly reflects that this is an immutable pointer to string data.src/alpha_shape/alphaShape_driver.cpp (2)
66-66
: Good use of const-correctness on input parameterThe change from
char*
toconst char*
for theedges_sql
parameter correctly reflects that this SQL string should not be modified within the function, improving type safety.
82-82
: Appropriate const declaration for hint variableChanging the
hint
variable fromchar*
toconst char*
maintains type consistency with the input parameter and properly reflects that this is an immutable pointer to string data.src/components/connectedComponents_driver.cpp (1)
47-47
: Enforce const-correctness for SQL input and hint pointer
The change fromchar*
toconst char*
for theedges_sql
parameter and thehint
variable correctly enforces immutability of the input query string. Ensure the corresponding declaration indrivers/components/connectedComponents_driver.h
has been updated to match this new signature.Also applies to: 62-62
src/circuits/hawickCircuits_driver.cpp (1)
63-63
: Apply const-correctness to input SQL and hint
Switchingedges_sql
andhint
toconst char*
prevents unintended modifications to the query string. Please confirm that the headerdrivers/circuits/hawickCircuits_driver.h
reflects this update.Also applies to: 79-79
src/coloring/bipartite_driver.cpp (1)
48-48
: Improve const-safety for SQL parameter and hint
Changing theedges_sql
parameter andhint
local toconst char*
is a correct const-correctness improvement. Verify that the signature indrivers/coloring/bipartite_driver.h
is also updated accordingly.Also applies to: 62-62
src/lineGraph/lineGraphFull_driver.cpp (1)
71-71
: Enforce immutability of SQL string and hint
Updatingedges_sql
andhint
toconst char*
properly signals that the SQL text is not modified. Ensuredrivers/lineGraph/lineGraphFull_driver.h
matches this signature change.Also applies to: 84-84
src/components/biconnectedComponents_driver.cpp (1)
48-48
: Apply const-correctness to input parameter and hint
The switch toconst char*
foredges_sql
and the localhint
variable correctly enforces immutability. Please confirm the headerdrivers/components/biconnectedComponents_driver.h
has been updated as well.Also applies to: 63-63
src/coloring/edgeColoring_driver.cpp (2)
41-41
: Excellent use of const-correctness.Changing the
edges_sql
parameter toconst char*
enforces immutability of the input SQL string, which is a good practice since this function doesn't modify the string.
56-56
: Good alignment with parameter const-ness.Updating the
hint
variable toconst char*
maintains consistent const-correctness with the input parameter. This ensures type safety throughout the function.src/dominator/lengauerTarjanDominatorTree_driver.cpp (2)
49-49
: Proper const-correctness applied.The change to
const char*
for theedges_sql
parameter is appropriate since the input SQL string is not modified within this function.
65-65
: Consistent type safety implementation.Changing the
hint
variable toconst char*
aligns with the parameter change and maintains type safety throughout the error handling flow.src/allpairs/johnson_driver.cpp (2)
45-45
: Good improvement to type safety.Converting the
edges_sql
parameter toconst char*
correctly enforces that the input SQL string is not modified within this function.
56-56
: Appropriate update for const-correctness.The change of
hint
toconst char*
properly aligns with the parameter change and ensures type safety in error reporting.src/components/bridges_driver.cpp (2)
47-47
: Properly enforced const-correctness.Changing the
edges_sql
parameter toconst char*
correctly signals that this function doesn't modify the input SQL string.
61-61
: Consistent type safety across variables.Updating the
hint
variable toconst char*
maintains const-correctness alignment with the function parameters and improves type safety.src/chinese/chinesePostman_driver.cpp (2)
47-47
: Enforce const-correctness on SQL parameter
Changing theedges_sql
parameter fromchar *
toconst char *
prevents accidental modification of the input SQL string and strengthens API safety.
61-61
: Make hint pointer immutable
Updating the localhint
variable toconst char *
aligns it with the immutableedges_sql
and avoids unintended writes to the hint string.src/components/makeConnected_driver.cpp (2)
45-45
: Apply const-correctness to edges_sql
Switching theedges_sql
parameter toconst char *
ensures that the SQL query string remains read-only withinpgr_do_makeConnected
.
61-61
: Update hint to const char*
Changinghint
toconst char *
maintains consistency with the immutable SQL input and prevents modification of the hint pointer.src/breadthFirstSearch/breadthFirstSearch_driver.cpp (2)
59-59
: Improve const-correctness for edges_sql
Refactoringedges_sql
toconst char *
enforces immutability of the SQL string inpgr_do_breadthFirstSearch
.
77-77
: Make hint pointer const
Updatinghint
toconst char *
aligns it with the read-only SQL input and avoids accidental writes.src/breadthFirstSearch/binaryBreadthFirstSearch_driver.cpp (2)
126-127
: Enforce const on SQL input parameters
Changing bothedges_sql
andcombinations_sql
toconst char *
ensures neither of the input query strings can be modified withinpgr_do_binaryBreadthFirstSearch
.
147-147
: Convert hint to const char*
Updating thehint
variable toconst char *
matches the immutability of the SQL inputs and prevents unintended mutation.src/driving_distance/driving_distance_driver.cpp (2)
48-48
: Switch edges_sql to const char*
Updatingedges_sql
to aconst char *
parameter reinforces that the SQL string is not modified bypgr_do_drivingDistance
.
67-67
: Make hint immutable
Changinghint
toconst char *
keeps the hint pointer consistent with the now read-only SQL input.src/contraction/contractionHierarchies_driver.cpp (2)
49-49
: Appropriate const-correctness update to parameterThe change to
const char *edges_sql
is correct as the function doesn't modify the SQL query string. This enforces const-correctness and improves type safety.
66-66
: Appropriate const-correctness update to hint variableThe local
hint
variable is updated toconst char *
to maintain consistency with the function parameters. This is a good change ashint
points to immutable SQL strings used only for error reporting.src/max_flow/minCostMaxFlow_driver.cpp (2)
50-51
: Good SQL parameter const-correctness improvementChanging both SQL string parameters (
edges_sql
andcombinations_sql
) toconst char *
enforces that these input strings won't be modified by the function, which aligns with how they're actually used.
69-69
: Appropriate const update to hint variableThe
hint
variable is properly updated toconst char *
to maintain type consistency with the function parameters it points to.src/bellman_ford/edwardMoore_driver.cpp (2)
68-69
: Proper const-correctness update to SQL parametersGood change to both SQL string parameters, ensuring they're treated as immutable inputs as intended.
90-90
: Consistent update to the hint pointerThe
hint
variable is correctly changed toconst char *
for consistency with the const parameters it references.src/bellman_ford/bellman_ford_neg_driver.cpp (2)
68-70
: Good const-correctness improvement to all SQL parametersAll three SQL string parameters are properly updated to
const char *
, which correctly enforces that these input strings won't be modified within the function.
92-92
: Consistent hint variable updateThe
hint
local variable is appropriately changed toconst char *
to align with the parameters it references.src/bellman_ford/bellman_ford_driver.cpp (2)
68-69
: Good improvement to const-correctness in function parametersThe change from
char*
toconst char*
for the SQL query parameters enhances type safety by explicitly indicating these strings won't be modified within the function.
90-90
: Correct update to local hint variableChanging
hint
toconst char*
maintains consistency with the function parameters and properly reflects the immutable nature of the string data it points to.src/ksp/ksp_driver.cpp (2)
49-50
: Good improvement to const-correctness in function parametersThe change from
char*
toconst char*
for the SQL query parameters enhances type safety by explicitly indicating these strings won't be modified within the function.
75-75
: Correct update to local hint variableChanging
hint
toconst char*
maintains consistency with the function parameters and properly reflects the immutable nature of the string data it points to.src/bdDijkstra/bdDijkstra_driver.cpp (2)
83-84
: Good improvement to const-correctness in function parametersThe change from
char*
toconst char*
for the SQL query parameters enhances type safety by explicitly indicating these strings won't be modified within the function.
105-105
: Correct update to local hint variableChanging
hint
toconst char*
maintains consistency with the function parameters and properly reflects the immutable nature of the string data it points to.src/max_flow/edge_disjoint_paths_driver.cpp (2)
75-76
: Good improvement to const-correctness in function parametersThe change from
char*
toconst char*
for the SQL query parameters enhances type safety by explicitly indicating these strings won't be modified within the function.
93-93
: Correct update to local hint variableChanging
hint
toconst char*
maintains consistency with the function parameters and properly reflects the immutable nature of the string data it points to.src/contraction/contractGraph_driver.cpp (2)
137-137
: Enforce const-correctness in SQL string parameter
Updating theedges_sql
parameter toconst char*
prevents accidental modification of the input SQL. Please ensure the corresponding function declaration incontractGraph_driver.h
is updated to match this change.
158-158
: Useconst char*
for internal hint tracking
Changing the localhint
variable toconst char*
aligns with the immutable nature of SQL strings passed into the function and avoids unnecessary casts.src/dijkstra/dijkstra_driver.cpp (2)
107-108
: Improve const-correctness on SQL inputs
Switching bothedges_sql
andcombinations_sql
toconst char*
enforces immutability of the SQL query strings. Confirm that the header declaration (dijkstra_driver.h
) has been updated accordingly.
133-133
: Localhint
should beconst char*
Updating thehint
pointer toconst char*
correctly reflects that it refers to immutable message strings and enhances const-safety internally.src/dagShortestPath/dagShortestPath_driver.cpp (2)
65-66
: Enforce immutability on SQL string parameters
Changing bothedges_sql
andcombinations_sql
parameters toconst char*
is a safe const-correctness improvement. Make sure the headerdagShortestPath_driver.h
signature is in sync.
89-89
: Declare internalhint
asconst char*
This update ensures thathint
accurately represents a pointer to constant strings, improving type safety.src/astar/astar_driver.cpp (2)
49-50
: Convert SQL parameters toconst char*
Updatingedges_sql
andcombinations_sql
toconst char*
prevents accidental data mutation and aligns with modern C++ best practices. Verify the corresponding header is updated.
72-72
: Useconst char*
forhint
Reflecting the immutability of the message pointers by declaringhint
asconst char*
enhances code clarity and safety.src/driving_distance/driving_distance_withPoints_driver.cpp (2)
52-54
: Apply const-correctness to SQL inputs
Updatingedges_sql
,points_sql
, andedges_of_points_sql
toconst char*
parameters enforces immutability of the SQL strings. Ensure the driver header is updated to match these signatures.
81-81
: Declarehint
asconst char*
Changing the internalhint
pointer toconst char*
aligns with its role as an immutable message reference and avoids mutable pointer types.src/bdAstar/bdAstar_driver.cpp (2)
50-51
: Good improvement of const-correctness for SQL query parameters.The change from
char*
toconst char*
for SQL query parametersedges_sql
andcombinations_sql
properly enforces immutability of these input strings, improving type safety.
73-73
: Consistent const-correctness for hint variable.Changing
hint
fromchar*
toconst char*
maintains consistency with the parameter changes and properly reflects that the hint pointer references immutable string data.src/ksp/turnRestrictedPath_driver.cpp (2)
82-83
: Good improvement of const-correctness for SQL query parameters.Properly changing
edges_sql
andrestrictions_sql
fromchar*
toconst char*
enforces immutability of these input strings in the driver function signature.
112-112
: Consistent const-correctness for hint variable.The local
hint
variable is correctly updated toconst char*
to maintain consistency with the parameter types and accurately reflect its usage as a pointer to immutable string data.src/dijkstra/dijkstraVia_driver.cpp (2)
93-93
: Good improvement of const-correctness for SQL query parameter.Changing
edges_sql
fromchar*
toconst char*
properly enforces that the SQL query string won't be modified within the function.
114-114
: Consistent const-correctness for hint variable.Updating the
hint
variable toconst char*
maintains type consistency with the parameter changes and properly reflects its usage as a pointer to immutable string data.src/max_flow/max_flow_driver.cpp (3)
48-49
: Good improvement of const-correctness for SQL query parameters.The change from
char*
toconst char*
for SQL query parametersedges_sql
andcombinations_sql
properly enforces immutability of these input strings.
68-68
: Consistent const-correctness for hint variable.Changing
hint
fromchar*
toconst char*
maintains consistency with the parameter types and accurately reflects its usage pattern.
108-108
: Fixed inconsistent error message handling.Good fix: The change from directly assigning
edges_sql
to usingto_pg_msg(edges_sql)
ensures proper memory allocation and consistent error message handling throughout the codebase.src/ksp/withPoints_ksp_driver.cpp (2)
51-54
: Excellent improvement to const-correctnessThe parameter types have been updated from
char*
toconst char*
for SQL query strings, which properly enforces that these strings should not be modified by the function. This is a good C++ practice that improves type safety and documents the intended usage of these parameters.
83-83
: LGTM: Appropriate const-correctness for hint variableChanging
hint
toconst char*
correctly aligns with its usage in the code, as it's only used to point to constant string data and is never modified.
Fixes #2869
Changes proposed in this pull request:
char*
->const char*
@pgRouting/admins
Summary by CodeRabbit