2 Commitit b7a0b28926 ... 6cb86adf0d

Tekijä SHA1 Viesti Päivämäärä
  Serj Kalichev 6cb86adf0d Fix node_exists() 8 kuukautta sitten
  Serj Kalichev 251fbad043 pline_node_exists() refactoring 8 kuukautta sitten
1 muutettua tiedostoa jossa 2 lisäystä ja 65 poistoa
  1. 2 65
      src/pline.c

+ 2 - 65
src/pline.c

@@ -1311,31 +1311,6 @@ static void pline_print_type_help(const struct lysc_node *node,
 }
 
 
-/*
-static bool_t pline_node_exists(sr_session_ctx_t* sess, const char *xpath)
-{
-	sr_val_t *vals = NULL;
-	size_t val_num = 0;
-	bool_t found = BOOL_FALSE;
-	size_t i = 0;
-
-	if (!xpath)
-		return BOOL_FALSE;
-	sr_get_items(sess, xpath, 0, 0, &vals, &val_num);
-	for (i = 0; i < val_num; i++) {
-		// Engine can find defaults for entries but not entries themself
-		if (!vals[i].dflt) {
-			found = BOOL_TRUE;
-			break;
-		}
-	}
-	sr_free_values(vals, val_num);
-
-	return found;
-}
-*/
-
-
 static bool_t pline_find_node_within_tree(const struct lyd_node *nodes_list,
 	const struct lysc_node *node)
 {
@@ -1348,18 +1323,15 @@ static bool_t pline_find_node_within_tree(const struct lyd_node *nodes_list,
 		const char *default_value = NULL;
 		char *value = NULL;
 
-syslog(LOG_ERR, "iter: %s, node: %s", iter->schema->name, node->name);
 		if (iter->schema != node) {
-syslog(LOG_ERR, "iter != node");
-			if (pline_find_node_within_tree(lyd_child(nodes_list),
+			if (pline_find_node_within_tree(lyd_child(iter),
 				node))
 				return BOOL_TRUE;
 			continue;
 		}
 		if (iter->flags & LYD_DEFAULT) {
-syslog(LOG_ERR, "default");
 			continue;
-}
+		}
 		default_value = klysc_node_ext_default(iter->schema);
 		value = klyd_node_value(iter);
 		// Don't show "default" keys with default values
@@ -1383,7 +1355,6 @@ static bool_t pline_node_exists(sr_session_ctx_t* sess, const char *xpath,
 
 	if (!xpath)
 		return BOOL_FALSE;
-syslog(LOG_ERR, "xpath = %s", xpath);
 	if (sr_get_data(sess, xpath, 1, 0, 0, &data) != SR_ERR_OK)
 		return BOOL_FALSE;
 	if (!data) // Not found
@@ -1394,40 +1365,6 @@ syslog(LOG_ERR, "xpath = %s", xpath);
 	sr_release_data(data);
 
 	return found;
-
-
-/*
-	nodes_list = data->tree;
-
-	while (nodes_list && (edepth > 0)) {
-		nodes_list = lyd_child_no_keys(nodes_list);
-		edepth--;
-	}
-
-	if (nodes_list)
-		show_subtree(nodes_list, 0, DIFF_OP_NONE, opts, BOOL_FALSE);
-
-
-
-	sr_val_t *vals = NULL;
-	size_t val_num = 0;
-	size_t i = 0;
-
-	if (!xpath)
-		return BOOL_FALSE;
-	sr_get_items(sess, xpath, 0, 0, &vals, &val_num);
-	for (i = 0; i < val_num; i++) {
-		// Engine can find defaults for entries but not entries themself
-		if (!vals[i].dflt) {
-			found = BOOL_TRUE;
-			break;
-		}
-	}
-	sr_free_values(vals, val_num);
-
-	return found;
-*/
-
 }