[riot-notifications] [RIOT] shell: refactor default shell command handling (#300)

LudwigOrtmann notifications at github.com
Wed Nov 13 19:27:56 CET 2013


>  #ifdef MODULE_SHELL_COMMANDS
> -    entry = _shell_command_list;
> -
> -    while (entry->name != NULL) {
> -        if (strcmp(entry->name, command) == 0) {
> -            return entry->handler;
> -        }
> -        else {
> -            entry++;
> +        _shell_command_list,
> +#endif
> +    };
> +
> +    const shell_command_t *entry;
> +

Maybe you could add comments like 'iterate over lists' and 'iterate over list-entries' here and below.
Also, the use of `sizeof(entry)` irritated me, `sizeof(shell_command_t)` would make this a little clearer I guess.

---
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/300/files#r7635289
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20131113/b720fc8b/attachment.html>


More information about the notifications mailing list