Add mgp_path_copy to C API

Reviewers: ipaljak

Reviewed By: ipaljak

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2694
This commit is contained in:
Teon Banek 2020-02-28 09:36:29 +01:00
parent bb4e747fd3
commit 4049b9d10a
2 changed files with 10 additions and 0 deletions

View File

@ -344,6 +344,12 @@ const struct mgp_map_item *mgp_map_items_iterator_next(
struct mgp_path *mgp_path_make_with_start(const struct mgp_vertex *vertex,
struct mgp_memory *memory);
/// Copy a mgp_path.
/// Returned pointer must be freed with mgp_path_destroy.
/// NULL is returned if unable to allocate a mgp_path.
struct mgp_path *mgp_path_copy(const struct mgp_path *path,
struct mgp_memory *memory);
/// Free the memory used by the given mgp_path and contained vertices and edges.
void mgp_path_destroy(struct mgp_path *path);

View File

@ -729,6 +729,10 @@ mgp_path *mgp_path_make_with_start(const mgp_vertex *vertex,
return path;
}
mgp_path *mgp_path_copy(const mgp_path *path, mgp_memory *memory) {
return new_mgp_object<mgp_path>(memory, *path);
}
void mgp_path_destroy(mgp_path *path) { delete_mgp_object(path); }
int mgp_path_expand(mgp_path *path, const mgp_edge *edge) {