Skip to content
Browse files

NEW: delete_logtop_state

  • Loading branch information...
1 parent f820052 commit 54d49b1fe1dc8c2e13e65c098f77d2ad9b84d3eb Julien Palard committed Aug 10, 2013
Showing with 12 additions and 2 deletions.
  1. +4 −0 ChangeLog
  2. +1 −2 logtop.i
  3. +6 −0 src/logtop.c
  4. +1 −0 src/logtop.h
View
4 ChangeLog
@@ -1,3 +1,7 @@
+2013-08-10 17:44:01 +0200 Julien Palard <julien@eeple.fr>
+
+ * NEW: delete_logtop_state
+
2013-08-10 17:43:32 +0200 Julien Palard <julien@eeple.fr>
* FIX: Makefile to build liblogtop.
View
3 logtop.i
@@ -34,8 +34,7 @@
tmp = PyFloat_FromDouble(result->frequency);
PyDict_SetItemString($result, "frequency", tmp);
Py_DECREF(tmp);
- free(result->lines);
- free(result);
+ delete_logtop_state(result);
}
struct logtop
View
6 src/logtop.c
@@ -92,6 +92,12 @@ struct logtop_state *logtop_get(struct logtop *this, size_t qte)
return NULL;
}
+void delete_logtop_state(struct logtop_state *this)
+{
+ free(this->lines);
+ free(this);
+}
+
double logtop_timespan(struct logtop *this)
{
history_element_t *oldest_element;
View
1 src/logtop.h
@@ -84,6 +84,7 @@ struct logtop*new_logtop(size_t history_size);
void delete_logtop(struct logtop *this);
void logtop_feed(struct logtop *this, char *line);
struct logtop_state *logtop_get(struct logtop *this, size_t qte);
+void delete_logtop_state(struct logtop_state *this);
double logtop_timespan(struct logtop *this);
unsigned int logtop_qte_of_elements(struct logtop *this);
#endif

0 comments on commit 54d49b1

Please sign in to comment.
Something went wrong with that request. Please try again.