mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 21:50:11 +01:00
Don't do a linear search through all names, but use binary search. Upside: calling nms_ifcfg_rh_utils_get_ethtool_by_name() in a loop (once over all 60 names) is 75% faster. Downside: when adding a new feature, we have yet another line that we need to add. Previously, adding a new feature required adding 7 lines, not it is 8. But we didn't add a single feature since this was added, so that happens very seldom. Possible downside: is this code harder to read? Now we track both how to convert the ID to name and back. This is redundant (and thus harder to maintain). But it's really just one extra line per feature, for which there is a unit test. So, when adding a new NMEthtoolID it would be pretty hard to mess this up, because of all the tests and assertions. So, maybe it's slightly harder to read. On the other hand, it unifies handling for ethtool and kernel names, and the code has less logic and is more descriptive. I don't think this is actually harder to maintain and it should be easy to see that it is correct (readability). |
||
|---|---|---|
| .. | ||
| plugins | ||
| nm-agent-manager.c | ||
| nm-agent-manager.h | ||
| nm-secret-agent.c | ||
| nm-secret-agent.h | ||
| nm-settings-connection.c | ||
| nm-settings-connection.h | ||
| nm-settings-plugin.c | ||
| nm-settings-plugin.h | ||
| nm-settings-storage.c | ||
| nm-settings-storage.h | ||
| nm-settings-utils.c | ||
| nm-settings-utils.h | ||
| nm-settings.c | ||
| nm-settings.h | ||