Skip to content

Commit

Permalink
Merge pull request scipy#485 from WarrenWeckesser/sig-gcc-warnings
Browse files Browse the repository at this point in the history
MAINT: signal: clean up some C code to eliminate a few compiler warnings
  • Loading branch information
rgommers committed Mar 31, 2013
2 parents 2c4b47c + 887659a commit 368bf94
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion scipy/signal/lfilter.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef void (BasicFilterFunction) (char *, char *, char *, char *, char *, int
static BasicFilterFunction *BasicFilterFunctions[256];

void
scipy_signal_sigtools_linear_filter_module_init()
scipy_signal_sigtools_linear_filter_module_init(void)
{
int k;
for (k = 0; k < 256; ++k) {
Expand Down
2 changes: 1 addition & 1 deletion scipy/signal/sigtools.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ PyObject*
scipy_signal_sigtools_correlateND(PyObject *NPY_UNUSED(dummy), PyObject *args);

void
scipy_signal_sigtools_linear_filter_module_init();
scipy_signal_sigtools_linear_filter_module_init(void);

/*
static int index_out_of_bounds(int *, int *, int );
Expand Down
25 changes: 6 additions & 19 deletions scipy/signal/sigtoolsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ static PyObject *sigtools_convolve2d(PyObject *NPY_UNUSED(dummy), PyObject *args
int mode=2, boundary=0, typenum, flag, flip=1, ret;
intp *aout_dimens=NULL, *dims=NULL;
char zeros[32]; /* Zeros */
int n1, n2, i;
int i;
PyArrayObject *ain1=NULL, *ain2=NULL, *aout=NULL;
PyArrayObject *afill=NULL, *newfill=NULL;

Expand Down Expand Up @@ -1041,10 +1041,7 @@ static PyObject *sigtools_convolve2d(PyObject *NPY_UNUSED(dummy), PyObject *args
newfill = (PyArrayObject *)PyArray_SimpleNewFromData(0, dims, typenum, zeros);
if (newfill == NULL) goto fail;
}

n1 = PyArray_Size((PyObject *)ain1);
n2 = PyArray_Size((PyObject *)ain2);


aout_dimens = malloc(ain1->nd*sizeof(intp));
switch(mode & OUTSIZE_MASK) {
case VALID:
Expand Down Expand Up @@ -1326,7 +1323,7 @@ static struct PyModuleDef moduledef = {
};
PyObject *PyInit_sigtools(void)
{
PyObject *m, *d, *s;
PyObject *m;

m = PyModule_Create(&moduledef);
import_array();
Expand All @@ -1339,10 +1336,8 @@ PyObject *PyInit_sigtools(void)
/* Initialization function for the module (*must* be called initsigtools) */

PyMODINIT_FUNC initsigtools(void) {
PyObject *m, *d;

/* Create the module and add the functions */
m = Py_InitModule("sigtools", toolbox_module_methods);
/* Create the module and add the functions */
Py_InitModule("sigtools", toolbox_module_methods);

/* Import the C API function pointers for the Array Object*/
import_array();
Expand All @@ -1354,15 +1349,7 @@ PyMODINIT_FUNC initsigtools(void) {
PyImport_ImportModule("numpy.core.multiarray");
/* { PyObject *multi = PyImport_ImportModule("multiarray"); } */

/* Add some symbolic constants to the module */
d = PyModule_GetDict(m);

/* PyDict_SetItemString(d,"BANDPASS", PyInt_FromLong((long) BANDPASS));
PyDict_SetItemString(d,"DIFFERENTIATOR", PyInt_FromLong((long) DIFFERENTIATOR));
PyDict_SetItemString(d,"HILBERT", PyInt_FromLong((long) HILBERT));
*/

scipy_signal_sigtools_linear_filter_module_init();
scipy_signal_sigtools_linear_filter_module_init();

/* Check for errors */
if (PyErr_Occurred()) {
Expand Down

0 comments on commit 368bf94

Please sign in to comment.