diff options
author | Colomban Wendling <[email protected]> | 2023-11-15 14:45:37 +0100 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-11-21 20:19:58 +0000 |
commit | e59c6d0276832bf8201561f71718daeca2465360 (patch) | |
tree | 0008a84964240aa65a983453c299468576d618fb /applets/wncklet/workspace-switcher.c | |
parent | ec5938e508526a70962e770ddd811f020951d1e8 (diff) | |
download | mate-panel-e59c6d0276832bf8201561f71718daeca2465360.tar.bz2 mate-panel-e59c6d0276832bf8201561f71718daeca2465360.tar.xz |
Optimize mate_panel_applet_settings_get_g*list()
- Build the list in reverse order, then reverse the result. This is
useful because GS?List are list nodes, not containers of nodes, and
thus don't contain a pointer to the list's end, meaning to append one
has to walk the entire list to find the end each time. To avoid this
we use the common idiom of prepending to the list (which is cheap, as
it's adding a node before the given one), and then reversing the
resulting list to get back the original order.
- Avoid unnecessary memory copy by stealing the GStrv's members. We
get the array as a copy, so we can simply steal the members and free
the container array only, saving a copy for each member.
Diffstat (limited to 'applets/wncklet/workspace-switcher.c')
0 files changed, 0 insertions, 0 deletions