History

ext/: use new proxy functions

Paul Brossier committed 10 years ago

Commit b5bef111 parent bfe82567 files · +118 −87Browse files

Showing the changes to python/ext/py-filter.c (1 of 7 files). Show all

Unified · Split

python/ext/py-filter.c+7−7
@@ -5,6 +5,7 @@ typedef struct · 4 unmodified lines
55 PyObject_HEAD
66 aubio_filter_t * o;
77 uint_t order;
8+ fvec_t *vec;
89 fvec_t *out;
910 } Py_filter;
1011
@@ -49,6 +50,7 @@ Py_filter_init (Py_filter * self, PyObject * args, PyObject * kwds) · 38 unmodified lines
4950 return -1;
5051 }
5152 self->out = new_fvec(Py_default_vector_length);
53+ self->vec = (fvec_t *)malloc(sizeof(fvec_t));
5254 return 0;
5355 }
5456
@@ -57,6 +59,7 @@ Py_filter_del (Py_filter * self) · 2 unmodified lines
5759 {
5860 del_fvec(self->out);
5961 del_aubio_filter (self->o);
62+ free(self->vec);
6063 Py_TYPE(self)->tp_free ((PyObject *) self);
6164 }
6265
@@ -64,7 +67,6 @@ static PyObject * · 1 unmodified line
6467 Py_filter_do(Py_filter * self, PyObject * args)
6568 {
6669 PyObject *input;
67− fvec_t *vec;
6870
6971 if (!PyArg_ParseTuple (args, "O:digital_filter.do", &input)) {
7072 return NULL;
@@ -74,19 +76,17 @@ Py_filter_do(Py_filter * self, PyObject * args) · 3 unmodified lines
7476 return NULL;
7577 }
7678
77− vec = PyAubio_ArrayToCFvec (input);
78−
79− if (vec == NULL) {
79+ if (!PyAubio_ArrayToCFvec(input, self->vec)) {
8080 return NULL;
8181 }
8282
8383 // reallocate the output if needed
84− if (vec->length != self->out->length) {
84+ if (self->vec->length != self->out->length) {
8585 del_fvec(self->out);
86− self->out = new_fvec(vec->length);
86+ self->out = new_fvec(self->vec->length);
8787 }
8888 // compute the function
89− aubio_filter_do_outplace (self->o, vec, self->out);
89+ aubio_filter_do_outplace (self->o, self->vec, self->out);
9090 return PyAubio_CFvecToArray(self->out);
9191 }
9292

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t