/* Go through timeout list (for this task only) and remove the first matching entry, even though the timeout has not triggered yet. */
void sys_untimeout(sys_timeout_handler h, void *arg)
/* Go through timeout list (for this task only) and remove the first matching entry, even though the timeout has not triggered yet. */
void sys_untimeout(sys_timeout_handler h, void *arg)
{
  struct sys_timeouts *timeouts;
  struct sys_timeo *prev_t, *t;
  timeouts = sys_arch_timeouts();
  if (timeouts == NULL) {
    LWIP_ASSERT("sys_untimeout: timeouts != NULL", timeouts != NULL);
    return;
  }
  if (timeouts->next == NULL) {
    return;
  }
  for (t = timeouts->next, prev_t = NULL; t != NULL; prev_t = t, t = t->next) {
    if ((t->h == h) && (t->arg == arg)) {
      if (prev_t == NULL) {
        timeouts->next = t->next;
      } else {
        prev_t->next = t->next;
      }
      if (t->next != NULL) {
        t->next->time += t->time;
      }
      memp_free(MEMP_SYS_TIMEOUT, t);
      return;
    }
  }
  return;
}