Skip to content

Commit

Permalink
NEW: delete_logtop_state
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Palard committed Aug 10, 2013
1 parent f820052 commit 54d49b1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions 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> 2013-08-10 17:43:32 +0200 Julien Palard <julien@eeple.fr>


* FIX: Makefile to build liblogtop. * FIX: Makefile to build liblogtop.
Expand Down
3 changes: 1 addition & 2 deletions logtop.i
Expand Up @@ -34,8 +34,7 @@
tmp = PyFloat_FromDouble(result->frequency); tmp = PyFloat_FromDouble(result->frequency);
PyDict_SetItemString($result, "frequency", tmp); PyDict_SetItemString($result, "frequency", tmp);
Py_DECREF(tmp); Py_DECREF(tmp);
free(result->lines); delete_logtop_state(result);
free(result);
} }


struct logtop struct logtop
Expand Down
6 changes: 6 additions & 0 deletions src/logtop.c
Expand Up @@ -92,6 +92,12 @@ struct logtop_state *logtop_get(struct logtop *this, size_t qte)
return NULL; return NULL;
} }


void delete_logtop_state(struct logtop_state *this)
{
free(this->lines);
free(this);
}

double logtop_timespan(struct logtop *this) double logtop_timespan(struct logtop *this)
{ {
history_element_t *oldest_element; history_element_t *oldest_element;
Expand Down
1 change: 1 addition & 0 deletions src/logtop.h
Expand Up @@ -84,6 +84,7 @@ struct logtop*new_logtop(size_t history_size);
void delete_logtop(struct logtop *this); void delete_logtop(struct logtop *this);
void logtop_feed(struct logtop *this, char *line); void logtop_feed(struct logtop *this, char *line);
struct logtop_state *logtop_get(struct logtop *this, size_t qte); 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); double logtop_timespan(struct logtop *this);
unsigned int logtop_qte_of_elements(struct logtop *this); unsigned int logtop_qte_of_elements(struct logtop *this);
#endif #endif

0 comments on commit 54d49b1

Please sign in to comment.