[PATCH 0/6] MR78: NSI and GetAdaptersInfo() performance improvements

Huw Davies (@huw) wine at gitlab.winehq.org
Tue May 17 04:39:19 CDT 2022


Huw Davies (@huw) commented about dlls/nsiproxy.sys/ndis.c:
>          }
> +
> +    if (!ret)
> +    {
> +        update_if_table();
> +        while (&entry->entry != &if_list)
> +        {
> +            if (entry->if_luid.Value == luid->Value)
> +            {
> +                *unix_name = entry->if_unix_name;
> +                ret = TRUE;
> +                break;
> +            }
> +            entry = LIST_ENTRY(entry->entry.next, struct if_entry, entry);
> +        }
> +    }
This is pretty fragile and assumes `update_if_table()` appends to the list - simply restart the loop again.  Better yet, enclose the first loop in something like this:
```c
do {} while(!updated++);
```

-- 
https://gitlab.winehq.org/wine/wine/-/merge_requests/78#note_935



More information about the wine-devel mailing list