[riot-notifications] [RIOT-OS/RIOT] tests/gnrc_udp: Replace atoi() by strtol(). (#11356)

Martine Lenders notifications at github.com
Mon Apr 8 20:11:12 CEST 2019

miri64 requested changes on this pull request.

Weird error handling, but apparently it is the only way with that function.

However, please only use `goto` if there is no other elegant way. Jumping into the middle of the function is not at all elegant ;-).

>          uint32_t num = 1;
         uint32_t delay = 1000000LU;
+        if (argc > 5) {
+            num = strtol(argv[5], &conversion_end, 0);
+            if (*conversion_end != '\0') {
+                goto send_syntax_err;

Rather use a `_usage()` function here and just `return 1`. Jumping into the middle of some `if`-handling just invites spaghetti code.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190408/d0285b12/attachment.html>

More information about the notifications mailing list