diff options
author | Mikael Kanstrup <mikael.kanstrup@gmail.com> | 2017-08-25 11:27:38 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2017-08-28 14:43:13 +0000 |
commit | 3b16cc8b219e087e6b8cc8898ed8e4d58263d326 (patch) | |
tree | 17474bcfae8528356f475a42f1043fa022acfafb /ui/qt/wireshark_application.cpp | |
parent | 81c48eacccbeb3466e607c0f708f38869da70491 (diff) |
iface_lists: Access ifaces member by reference
Change access of ifaces elements from by val to by reference.
With this change unnecessary copying of the whole struct is avoided
but even more important is that elements no longer have to be
removed and inserted whenever data is updated.
This change aims to make it more clear that ifaces elements shall
never directly be removed from the array. Instead use function
capture_opts_del_iface
NOTE: Code for GTK UI not updated
Ping-Bug: 13864
Change-Id: I04b65d5ee36526b30d959b8e5a2a48a3c7c4f15b
Reviewed-on: https://code.wireshark.org/review/23204
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui/qt/wireshark_application.cpp')
-rw-r--r-- | ui/qt/wireshark_application.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index d6d46f38d5..a9340438ea 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -1027,7 +1027,7 @@ iface_mon_event_cb(const char *iface, int up) int present = 0; guint ifs, j; interface_t *device; - interface_options interface_opts; + interface_options *interface_opts; for (ifs = 0; ifs < global_capture_opts.all_ifaces->len; ifs++) { device = &g_array_index(global_capture_opts.all_ifaces, interface_t, ifs); @@ -1040,8 +1040,8 @@ iface_mon_event_cb(const char *iface, int up) * for capturing. */ for (j = 0; j < global_capture_opts.ifaces->len; j++) { - interface_opts = g_array_index(global_capture_opts.ifaces, interface_options, j); - if (strcmp(interface_opts.name, device->name) == 0) { + interface_opts = &g_array_index(global_capture_opts.ifaces, interface_options, j); + if (strcmp(interface_opts->name, device->name) == 0) { g_array_remove_index(global_capture_opts.ifaces, j); } } |