Introduce extern clear_interrupts() function in order to free allocated
  for all_interrupts memory. We can call it from do_process instead of
  iterating through all_interrupts.

Signed-off-by: Sergey Senozhatsky <[email protected]>

---

diff --git a/process/interrupt.cpp b/process/interrupt.cpp
index 46bd76d..85e1bea 100644
--- a/process/interrupt.cpp
+++ b/process/interrupt.cpp
@@ -108,3 +108,12 @@ void all_interrupts_to_all_power(void)
                if (all_interrupts[i]->accumulated_runtime)
                        all_power.push_back(all_interrupts[i]);
 }
+
+void clear_interrupts(void)
+{
+       std::vector<class interrupt *>::iterator it = all_interrupts.begin();
+       while (it != all_interrupts.end()) {
+               delete *it;
+               it = all_interrupts.erase(it);
+       }
+}
diff --git a/process/interrupt.h b/process/interrupt.h
index 900d689..cf71d72 100644
--- a/process/interrupt.h
+++ b/process/interrupt.h
@@ -47,7 +47,6 @@ public:
 
        virtual const char * name(void) { return "interrupt"; };
        virtual const char * type(void) { return "Interrupt"; };
-
 };
 
 extern vector <class interrupt *> all_interrupts;
@@ -56,8 +55,6 @@ extern const char* softirqs[];
 
 extern class interrupt * find_create_interrupt(const char *_handler, int nr, 
int cpu);
 extern void all_interrupts_to_all_power(void);
+extern void clear_interrupts(void);
 
-
-
-
-#endif
\ No newline at end of file
+#endif

_______________________________________________
Discuss mailing list
[email protected]
http://lists.lesswatts.org/listinfo/discuss

Reply via email to