Skip to content

Commit e3aec66

Browse files
committed
context REFACTOR move leafref links cb to ly_common
1 parent f1e83af commit e3aec66

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

src/context.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,6 @@ ly_ctx_load_module(struct ly_ctx *ctx, const char *name, const char *revision, c
259259
return mod;
260260
}
261261

262-
ly_bool
263-
ly_ctx_ht_leafref_links_equal_cb(void *val1_p, void *val2_p, ly_bool UNUSED(mod), void *UNUSED(cb_data))
264-
{
265-
struct lyd_leafref_links_rec **rec1 = val1_p, **rec2 = val2_p;
266-
267-
return (*rec1)->node == (*rec2)->node;
268-
}
269-
270262
LIBYANG_API_DEF LY_ERR
271263
ly_ctx_new(const char *search_dir, uint32_t options, struct ly_ctx **new_ctx)
272264
{
@@ -685,15 +677,6 @@ lysc_node_clear_priv_dfs_cb(struct lysc_node *node, void *UNUSED(data), ly_bool
685677
return LY_SUCCESS;
686678
}
687679

688-
void
689-
ly_ctx_ht_leafref_links_rec_free(void *val_p)
690-
{
691-
struct lyd_leafref_links_rec **rec = val_p;
692-
693-
lyd_free_leafref_links_rec(*rec);
694-
free(*rec);
695-
}
696-
697680
LIBYANG_API_DEF LY_ERR
698681
ly_ctx_unset_options(struct ly_ctx *ctx, uint32_t option)
699682
{

src/ly_common.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,29 @@ ly_version_proj_str(void)
104104
return LY_PROJ_VERSION;
105105
}
106106

107+
/**
108+
* @brief Callback for comparing two leafref links records.
109+
*/
110+
ly_bool
111+
ly_ctx_ht_leafref_links_equal_cb(void *val1_p, void *val2_p, ly_bool UNUSED(mod), void *UNUSED(cb_data))
112+
{
113+
struct lyd_leafref_links_rec **rec1 = val1_p, **rec2 = val2_p;
114+
115+
return (*rec1)->node == (*rec2)->node;
116+
}
117+
118+
/**
119+
* @brief Callback for freeing two leafref links records.
120+
*/
121+
void
122+
ly_ctx_ht_leafref_links_rec_free(void *val_p)
123+
{
124+
struct lyd_leafref_links_rec **rec = val_p;
125+
126+
lyd_free_leafref_links_rec(*rec);
127+
free(*rec);
128+
}
129+
107130
/**
108131
* @brief Callback for comparing two pattern records.
109132
*/

0 commit comments

Comments
 (0)