Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fwsetup-ng.git;a=commitdiff;h=6ae158f223ef746ceb8d578bd04317db9f091b74

commit 6ae158f223ef746ceb8d578bd04317db9f091b74
Author: James Buren <[email protected]>
Date:   Mon Aug 27 01:54:30 2012 -0500

add deleteAll() for deleting the vector returned by probeAll()

diff --git a/Device.cc b/Device.cc
index 83c68a7..5630fac 100644
--- a/Device.cc
+++ b/Device.cc
@@ -115,6 +115,16 @@ vector <Device *> Device::probeAll()
return devices;
}

+void Device::deleteAll(vector <Device *> &devices)
+{
+  while(!devices.empty())
+  {
+    delete devices.back();
+
+    devices.pop_back();
+  }
+}
+
bool Device::read(const string &path)
{
int fd = -1;
diff --git a/Device.hh b/Device.hh
index 9282bdd..b3fc61f 100644
--- a/Device.hh
+++ b/Device.hh
@@ -14,6 +14,7 @@ public:
Device();
~Device();
static vector <Device *> probeAll();
+  static void deleteAll(vector <Device *> &devices);
bool read(const string &path);
bool write();
string getPath() { return _path; }
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to