<p><b>@keestux</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/10717#discussion_r300052345">sys/evtimer/evtimer.c</a>:</p>
<pre style='color:#555'>>  {
     DEBUG("evtimer: new event offset %" PRIu32 " ms\n", event->offset);
-    /* we want list->next to point to the first list element. thus we take the
-     * *address* of evtimer->events, then cast it from (evtimer_event_t **) to
-     * (evtimer_event_t*). After that, list->next actually equals
-     * evtimer->events. */
-    evtimer_event_t *list = (evtimer_event_t *)&evtimer->events;
-
-    while (list->next) {
-        evtimer_event_t *list_entry = list->next;
+    evtimer_event_t **list = &evtimer->events;
</pre>
<p>I'm in favor of easy to understand code. But I still prefer my version. What else can I do to convince you? Shall we measure code complexity (McCabe?), or shall we measure code size? Do we need more comments (it's basically a simple while-loop), explaining the iteration. ASCII art?</p>
<p>Leaving out DEBUG, it comes down to the following.</p>
<pre><code>static void evtimer_add_event_to_list(evtimer_t *evtimer, evtimer_event_t *event)
{
    evtimer_event_t **list = &evtimer->events;

    while (*list) {
        /* Stop when new event time is nearer then next */
        if (event->offset < (*list)->offset) {
            break;
        }
        /* Set event offset relative to previous event */
        event->offset -= (*list)->offset;
        list = &(*list)->next;
    }

    /* Set found next bigger event after new event */
    event->next = *list;
    if (*list) {
        /* Set offset following event relative to new event */
        (*list)->offset -= event->offset;
    }
    *list = event;
}
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/10717?email_source=notifications&email_token=ABE7WYHF5JQKG44DTCHTZCDP5TH37A5CNFSM4GOKOBP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5NMLNA#discussion_r300052345">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYEZOTYXBY5IFAPT7W3P5TH37ANCNFSM4GOKOBPQ">mute the thread</a>.<img src="https://github.com/notifications/beacon/ABE7WYEAXDVXDNXULFB3AK3P5TH37A5CNFSM4GOKOBP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5NMLNA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/10717?email_source=notifications\u0026email_token=ABE7WYHF5JQKG44DTCHTZCDP5TH37A5CNFSM4GOKOBP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5NMLNA#discussion_r300052345",
"url": "https://github.com/RIOT-OS/RIOT/pull/10717?email_source=notifications\u0026email_token=ABE7WYHF5JQKG44DTCHTZCDP5TH37A5CNFSM4GOKOBP2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB5NMLNA#discussion_r300052345",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>