diff options
Diffstat (limited to 'nuttx/binfmt/libbuiltin/libbuiltin_getname.c')
-rw-r--r-- | nuttx/binfmt/libbuiltin/libbuiltin_getname.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c index 01ac024f7..d1e3958b3 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c @@ -83,10 +83,14 @@ FAR const char *builtin_getname(int index) { - if (index < 0 || index >= number_builtins()) - { - return NULL; - } + FAR const struct builtin_s *builtin; - return g_builtins[index].name; + builtin = builtin_for_index(index); + + if (builtin != NULL) + { + return builtin->name; + } + + return NULL; } |