[PATCH v2 0/6] MR78: NSI and GetAdaptersInfo() performance improvements
Huw Davies (@huw)
wine at gitlab.winehq.org
Tue May 17 08:51:39 CDT 2022
Huw Davies (@huw) commented about dlls/nsiproxy.sys/ndis.c:
>
> pthread_mutex_lock( &if_list_lock );
>
> - update_if_table();
> + do
> + {
> + LIST_FOR_EACH_ENTRY( entry, &if_list, struct if_entry, entry )
> + if (entry->if_luid.Value == luid->Value)
> + {
> + *unix_name = entry->if_unix_name;
> + ret = TRUE;
> + goto done;
> + }
> + update_if_table();
> + }
> + while (!updated++);
Now we could end up calling `update_if_table()` twice which seems wasteful.
How about making `update_if_table()` return the number of entries it adds, then we could do something like
```c
do
{
} while (!updated++ && update_if_table());
```
Also, please keep the `while` on the same line as the closing brace (so it doesn't look like a while loop) and add braces around the `LIST_FOR_EACH_ENTRY()` block.
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/78#note_943
More information about the wine-devel
mailing list