mirror of
git://slackware.nl/current.git
synced 2024-12-29 10:25:00 +01:00
104 lines
3 KiB
Diff
104 lines
3 KiB
Diff
|
From c48855528beee1397d883f9c8a5df7aed5c917a6 Mon Sep 17 00:00:00 2001
|
||
|
From: Tim Waugh <twaugh@redhat.com>
|
||
|
Date: Wed, 23 Jun 2010 11:58:04 +0000
|
||
|
Subject: [PATCH] 2010-06-23 Tim Waugh <twaugh@redhat.com>
|
||
|
|
||
|
* src/ieee1284module.c: Fixed warnings.
|
||
|
---
|
||
|
src/ieee1284module.c | 37 ++++++++++++++++++++++++++++---------
|
||
|
2 files changed, 29 insertions(+), 9 deletions(-)
|
||
|
|
||
|
diff --git a/src/ieee1284module.c b/src/ieee1284module.c
|
||
|
index 30972f8..0093d6f 100644
|
||
|
--- a/src/ieee1284module.c
|
||
|
+++ b/src/ieee1284module.c
|
||
|
@@ -28,6 +28,17 @@ typedef struct {
|
||
|
struct parport *port;
|
||
|
} ParportObject;
|
||
|
|
||
|
+static PyObject *
|
||
|
+Parport_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||
|
+{
|
||
|
+ ParportObject *self;
|
||
|
+ self = (ParportObject *) type->tp_alloc (type, 0);
|
||
|
+ if (self != NULL)
|
||
|
+ self->port = NULL;
|
||
|
+
|
||
|
+ return (PyObject *) self;
|
||
|
+}
|
||
|
+
|
||
|
static int
|
||
|
Parport_init (ParportObject *self, PyObject *args, PyObject *kwds)
|
||
|
{
|
||
|
@@ -215,7 +226,6 @@ Parport_release (ParportObject *self)
|
||
|
static PyObject *
|
||
|
Parport_read_data (ParportObject *self)
|
||
|
{
|
||
|
- unsigned char b[2];
|
||
|
int r = ieee1284_read_data (self->port);
|
||
|
if (r < 0) {
|
||
|
handle_error (r);
|
||
|
@@ -258,7 +268,6 @@ Parport_data_dir (ParportObject *self, PyObject *args)
|
||
|
static PyObject *
|
||
|
Parport_read_status (ParportObject *self)
|
||
|
{
|
||
|
- unsigned char b[2];
|
||
|
int r = ieee1284_read_status (self->port);
|
||
|
if (r < 0) {
|
||
|
handle_error (r);
|
||
|
@@ -293,7 +302,6 @@ Parport_wait_status (ParportObject *self, PyObject *args)
|
||
|
static PyObject *
|
||
|
Parport_read_control (ParportObject *self)
|
||
|
{
|
||
|
- unsigned char b[2];
|
||
|
int r = ieee1284_read_control (self->port);
|
||
|
if (r < 0) {
|
||
|
handle_error (r);
|
||
|
@@ -435,7 +443,6 @@ Parport_##x (ParportObject *self, PyObject *args) \
|
||
|
int len; \
|
||
|
char *buffer; \
|
||
|
ssize_t wrote; \
|
||
|
- PyObject *ret; \
|
||
|
\
|
||
|
if (!PyArg_ParseTuple (args, "s#|i", &buffer, &len, &flags)) \
|
||
|
return NULL; \
|
||
|
@@ -562,6 +569,23 @@ static PyTypeObject ParportType = {
|
||
|
0, /* tp_as_buffer */
|
||
|
Py_TPFLAGS_DEFAULT, /* tp_flags */
|
||
|
"parallel port object", /* tp_doc */
|
||
|
+ 0, /* tp_traverse */
|
||
|
+ 0, /* tp_clear */
|
||
|
+ 0, /* tp_richcompare */
|
||
|
+ 0, /* tp_weaklistoffset */
|
||
|
+ 0, /* tp_iter */
|
||
|
+ 0, /* tp_iternext */
|
||
|
+ Parport_methods, /* tp_methods */
|
||
|
+ 0, /* tp_members */
|
||
|
+ Parport_getseters, /* tp_getset */
|
||
|
+ 0, /* tp_base */
|
||
|
+ 0, /* tp_dict */
|
||
|
+ 0, /* tp_descr_get */
|
||
|
+ 0, /* tp_descr_set */
|
||
|
+ 0, /* tp_dictoffset */
|
||
|
+ (initproc)Parport_init, /* tp_init */
|
||
|
+ 0, /* tp_alloc */
|
||
|
+ Parport_new, /* tp_new */
|
||
|
};
|
||
|
|
||
|
static PyObject *
|
||
|
@@ -625,14 +649,9 @@ initieee1284 (void)
|
||
|
PyObject *d = PyModule_GetDict (m);
|
||
|
PyObject *c;
|
||
|
|
||
|
- ParportType.tp_new = PyType_GenericNew;
|
||
|
- ParportType.tp_init = (initproc) Parport_init;
|
||
|
- ParportType.tp_getset = Parport_getseters;
|
||
|
- ParportType.tp_methods = Parport_methods;
|
||
|
if (PyType_Ready (&ParportType) < 0)
|
||
|
return;
|
||
|
|
||
|
- Py_INCREF (&ParportType);
|
||
|
PyModule_AddObject (m, "Parport", (PyObject *) &ParportType);
|
||
|
|
||
|
pyieee1284_error = PyErr_NewException("ieee1284.error", NULL, NULL);
|