Skip to content

Commit ca2e3b3

Browse files
committed
schema: remove custom lypy_node_fullname C function
No need for that much performance here. Do it in python. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent 855fa9a commit ca2e3b3

File tree

3 files changed

+1
-21
lines changed

3 files changed

+1
-21
lines changed

cffi/cdefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ int lyd_validate(struct lyd_node **, int, void *);
446446
void free(void *);
447447

448448
/* extra functions */
449-
char *lypy_node_fullname(const struct lys_node *);
450449
uint8_t lypy_module_implemented(const struct lys_module *);
451450
LY_ERR lypy_get_errno(void);
452451
void lypy_set_errno(LY_ERR);

cffi/source.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,6 @@
55

66
#include <libyang/libyang.h>
77

8-
static char *lypy_node_fullname(const struct lys_node *node)
9-
{
10-
const struct lys_module *module;
11-
char *fullname = NULL;
12-
13-
module = lys_node_module(node);
14-
if (!module)
15-
return NULL;
16-
17-
if (asprintf(&fullname, "%s:%s", module->name, node->name) < 0)
18-
return NULL;
19-
20-
return fullname;
21-
}
22-
238
static LY_ERR lypy_get_errno(void)
249
{
2510
return ly_errno;

libyang/schema.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -640,11 +640,7 @@ def name(self):
640640
return c2str(self._node.name)
641641

642642
def fullname(self):
643-
try:
644-
s = lib.lypy_node_fullname(self._node)
645-
return c2str(s)
646-
finally:
647-
lib.free(s)
643+
return '%s:%s' % (self.module().name(), self.name())
648644

649645
def description(self):
650646
return c2str(self._node.dsc)

0 commit comments

Comments
 (0)