[Python-checkins] python/dist/src/Modules ossaudiodev.c,1.19,1.20
Neal Norwitz
neal@metaslash.com
Tue, 31 Dec 2002 09:42:32 -0500
> Index: ossaudiodev.c
> + static int
> + build_namelists (PyObject *module)
> + {
> + PyObject *labels;
> + PyObject *names;
> + PyObject *s;
> + int num_controls;
> + int i;
> +
> + num_controls = sizeof(control_labels) / sizeof(control_labels[0]);
> + assert(num_controls == sizeof(control_names) / sizeof(control_names[0]));
> +
> + labels = PyList_New(num_controls);
> + names = PyList_New(num_controls);
> + for (i = 0; i < num_controls; i++) {
> + s = PyString_FromString(control_labels[i]);
> + if (s == NULL)
> + return -1;
> + PyList_SET_ITEM(labels, i, s);
> +
> + s = PyString_FromString(control_names[i]);
> + if (s == NULL)
> + return -1;
> + PyList_SET_ITEM(names, i, s);
> + }
> +
> + if (PyModule_AddObject(module, "control_labels", labels) == -1)
> + return -1;
> + if (PyModule_AddObject(module, "control_names", names) == -1)
> + return -1;
> +
> + return 0;
> + }
Greg, don't you need to DECREF labels & names for the first three
places you return -1? Does the last return -1 need a DECREF(names)?
Neal