summaryrefslogtreecommitdiff
path: root/lib/yang.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-11-02 21:51:43 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-11-26 17:35:58 -0200
commit80243aef050c1f882a169b402ff5c50fed63b451 (patch)
tree13886bad2557f36b3e19a40fd7b5d105727faecb /lib/yang.c
parent70065793bbd49e6648e329a60caf46be972e34f1 (diff)
lib: don't fetch schema information when creating yang_data structures
Prefetching the schema node when creating yang_data structures is expensive, and in most cases we don't need that information. In that case, fetch the schema information only when necessary to improve performance when fetching operational data. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.c')
-rw-r--r--lib/yang.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/lib/yang.c b/lib/yang.c
index a7a50a46b0..0e7ea3037e 100644
--- a/lib/yang.c
+++ b/lib/yang.c
@@ -522,22 +522,10 @@ void yang_dnode_free(struct lyd_node *dnode)
struct yang_data *yang_data_new(const char *xpath, const char *value)
{
- const struct lys_node *snode;
struct yang_data *data;
- snode = ly_ctx_get_node(ly_native_ctx, NULL, xpath, 0);
- if (!snode)
- snode = ly_ctx_get_node(ly_native_ctx, NULL, xpath, 1);
- if (!snode) {
- flog_err(EC_LIB_YANG_UNKNOWN_DATA_PATH,
- "%s: unknown data path: %s", __func__, xpath);
- zlog_backtrace(LOG_ERR);
- abort();
- }
-
data = XCALLOC(MTYPE_YANG_DATA, sizeof(*data));
strlcpy(data->xpath, xpath, sizeof(data->xpath));
- data->snode = snode;
if (value)
data->value = strdup(value);