diff options
author | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> | 2011-05-10 16:43:00 +0300 |
---|---|---|
committer | Arjan van de Ven <arjan@linux.intel.com> | 2011-05-11 00:04:39 -0400 |
commit | e74ee7a1de23089264c78c2227af9407d74456e3 (patch) | |
tree | fc1b8bec251260bf8a38c0b66792dc39506cbf14 | |
parent | 8287da740543f797d5ce39870c0bca81d27b46a3 (diff) | |
download | powertop-e74ee7a1de23089264c78c2227af9407d74456e3.tar.gz |
process/device: Introduce clear_proc_devices()
Introduce clear_proc_devices() function in order to clear
allocated for all_proc_devices memory.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
-rw-r--r-- | process/device.cpp | 9 | ||||
-rw-r--r-- | process/device.h | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/process/device.cpp b/process/device.cpp index 4d3d2c5..2fe7571 100644 --- a/process/device.cpp +++ b/process/device.cpp @@ -88,3 +88,12 @@ void all_devices_to_all_power(void) for (i = 0; i < all_devices.size(); i++) add_device(all_devices[i]); } + +void clear_proc_devices(void) +{ + std::vector<class device_consumer *>::iterator it = all_proc_devices.begin(); + while (it != all_proc_devices.end()) { + delete *it; + it = all_proc_devices.erase(it); + } +} diff --git a/process/device.h b/process/device.h index b40f3d2..3392d3e 100644 --- a/process/device.h +++ b/process/device.h @@ -50,5 +50,6 @@ public: extern void all_devices_to_all_power(void); extern vector<class device_consumer *> all_proc_devices; +extern void clear_proc_devices(void); -#endif
\ No newline at end of file +#endif |