mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Remove METH_OLDARGS:
Convert METH_OLDARGS -> METH_VARARGS: also PyArg_Parse -> PyArg_ParseTuple Convert METH_OLDARGS -> METH_NOARGS: remove args parameter Please review. All tests pass, but some modules don't have tests. I spot checked various functions to try to make sure nothing broke.
This commit is contained in:
		
							parent
							
								
									50905b557b
								
							
						
					
					
						commit
						ba3a16c6c3
					
				
					 11 changed files with 85 additions and 164 deletions
				
			
		| 
						 | 
					@ -14,7 +14,7 @@ static PyObject *crypt_crypt(PyObject *self, PyObject *args)
 | 
				
			||||||
	char *word, *salt; 
 | 
						char *word, *salt; 
 | 
				
			||||||
	extern char * crypt(const char *, const char *);
 | 
						extern char * crypt(const char *, const char *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "(ss)", &word, &salt)) {
 | 
						if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) {
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return PyString_FromString( crypt( word, salt ) );
 | 
						return PyString_FromString( crypt( word, salt ) );
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ the same alphabet as the salt.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef crypt_methods[] = {
 | 
					static PyMethodDef crypt_methods[] = {
 | 
				
			||||||
	{"crypt",	crypt_crypt, METH_OLDARGS, crypt_crypt__doc__},
 | 
						{"crypt",	crypt_crypt, METH_VARARGS, crypt_crypt__doc__},
 | 
				
			||||||
	{NULL,		NULL}		/* sentinel */
 | 
						{NULL,		NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -52,7 +52,7 @@ md5_update(md5object *self, PyObject *args)
 | 
				
			||||||
	unsigned char *cp;
 | 
						unsigned char *cp;
 | 
				
			||||||
	int len;
 | 
						int len;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s#", &cp, &len))
 | 
						if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MD5Update(&self->md5, cp, len);
 | 
						MD5Update(&self->md5, cp, len);
 | 
				
			||||||
| 
						 | 
					@ -142,7 +142,7 @@ Return a copy (``clone'') of the md5 object.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef md5_methods[] = {
 | 
					static PyMethodDef md5_methods[] = {
 | 
				
			||||||
	{"update",    (PyCFunction)md5_update,    METH_OLDARGS, update_doc},
 | 
						{"update",    (PyCFunction)md5_update,    METH_VARARGS, update_doc},
 | 
				
			||||||
	{"digest",    (PyCFunction)md5_digest,    METH_NOARGS,  digest_doc},
 | 
						{"digest",    (PyCFunction)md5_digest,    METH_NOARGS,  digest_doc},
 | 
				
			||||||
	{"hexdigest", (PyCFunction)md5_hexdigest, METH_NOARGS,  hexdigest_doc},
 | 
						{"hexdigest", (PyCFunction)md5_hexdigest, METH_NOARGS,  hexdigest_doc},
 | 
				
			||||||
	{"copy",      (PyCFunction)md5_copy,      METH_NOARGS,  copy_doc},
 | 
						{"copy",      (PyCFunction)md5_copy,      METH_NOARGS,  copy_doc},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1242,23 +1242,12 @@ MPZ_divm(PyObject *self, PyObject *args)
 | 
				
			||||||
} /* MPZ_divm() */
 | 
					} /* MPZ_divm() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* MPZ methods-as-attributes */
 | 
					 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
static PyObject *
 | 
					 | 
				
			||||||
mpz_int(mpzobject *self, PyObject *args)
 | 
					 | 
				
			||||||
#else /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
mpz_int(mpzobject *self)
 | 
					mpz_int(mpzobject *self)
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS else */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	long sli;
 | 
						long sli;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (mpz_size(&self->mpz) > 1
 | 
						if (mpz_size(&self->mpz) > 1
 | 
				
			||||||
	    || (sli = (long)mpz_get_ui(&self->mpz)) < (long)0 ) {
 | 
						    || (sli = (long)mpz_get_ui(&self->mpz)) < (long)0 ) {
 | 
				
			||||||
		PyErr_SetString(PyExc_ValueError,
 | 
							PyErr_SetString(PyExc_ValueError,
 | 
				
			||||||
| 
						 | 
					@ -1273,11 +1262,7 @@ mpz_int(mpzobject *self)
 | 
				
			||||||
} /* mpz_int() */
 | 
					} /* mpz_int() */
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
mpz_long(mpzobject *self, PyObject *args)
 | 
					 | 
				
			||||||
#else /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
mpz_long(mpzobject *self)
 | 
					mpz_long(mpzobject *self)
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS else */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, isnegative;
 | 
						int i, isnegative;
 | 
				
			||||||
	unsigned long int uli;
 | 
						unsigned long int uli;
 | 
				
			||||||
| 
						 | 
					@ -1287,11 +1272,6 @@ mpz_long(mpzobject *self)
 | 
				
			||||||
	MP_INT mpzscratch;
 | 
						MP_INT mpzscratch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* determine length of python-long to be allocated */
 | 
						/* determine length of python-long to be allocated */
 | 
				
			||||||
	if ((longobjp = _PyLong_New(i = (int)
 | 
						if ((longobjp = _PyLong_New(i = (int)
 | 
				
			||||||
			    ((mpz_size(&self->mpz) * BITS_PER_MP_LIMB
 | 
								    ((mpz_size(&self->mpz) * BITS_PER_MP_LIMB
 | 
				
			||||||
| 
						 | 
					@ -1352,13 +1332,8 @@ mpz_long(mpzobject *self)
 | 
				
			||||||
/* I would have avoided pow() anyways, so ... */
 | 
					/* I would have avoided pow() anyways, so ... */
 | 
				
			||||||
static const double multiplier = 256.0 * 256.0 * 256.0 * 256.0;
 | 
					static const double multiplier = 256.0 * 256.0 * 256.0 * 256.0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
static PyObject *
 | 
					 | 
				
			||||||
mpz_float(mpzobject *self, PyObject *args)
 | 
					 | 
				
			||||||
#else /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
mpz_float(mpzobject *self)
 | 
					mpz_float(mpzobject *self)
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS else */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i, isnegative;
 | 
						int i, isnegative;
 | 
				
			||||||
	double x;
 | 
						double x;
 | 
				
			||||||
| 
						 | 
					@ -1366,11 +1341,6 @@ mpz_float(mpzobject *self)
 | 
				
			||||||
	MP_INT mpzscratch;
 | 
						MP_INT mpzscratch;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	i = (int)mpz_size(&self->mpz);
 | 
						i = (int)mpz_size(&self->mpz);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* determine sign, and copy abs(self) to scratch var */
 | 
						/* determine sign, and copy abs(self) to scratch var */
 | 
				
			||||||
| 
						 | 
					@ -1406,40 +1376,20 @@ mpz_float(mpzobject *self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
} /* mpz_float() */
 | 
					} /* mpz_float() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
static PyObject *
 | 
					 | 
				
			||||||
mpz_hex(mpzobject *self, PyObject *args)
 | 
					 | 
				
			||||||
#else /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
mpz_hex(mpzobject *self)
 | 
					mpz_hex(mpzobject *self)
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS else */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return mpz_format((PyObject *)self, 16, (unsigned char)1);
 | 
						return mpz_format((PyObject *)self, 16, (unsigned char)1);
 | 
				
			||||||
} /* mpz_hex() */
 | 
					} /* mpz_hex() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
static PyObject *
 | 
					 | 
				
			||||||
mpz_oct(mpzobject *self, PyObject *args)
 | 
					 | 
				
			||||||
#else /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
mpz_oct(mpzobject *self)
 | 
					mpz_oct(mpzobject *self)
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS else */
 | 
					 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	return mpz_format((PyObject *)self, 8, (unsigned char)1);
 | 
						return mpz_format((PyObject *)self, 8, (unsigned char)1);
 | 
				
			||||||
} /* mpz_oct() */
 | 
					} /* mpz_oct() */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
mpz_binary(mpzobject *self, PyObject *args)
 | 
					mpz_binary(mpzobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int size;
 | 
						int size;
 | 
				
			||||||
	PyStringObject *strobjp;
 | 
						PyStringObject *strobjp;
 | 
				
			||||||
| 
						 | 
					@ -1447,9 +1397,6 @@ mpz_binary(mpzobject *self, PyObject *args)
 | 
				
			||||||
	MP_INT mp;
 | 
						MP_INT mp;
 | 
				
			||||||
	unsigned long ldigit;
 | 
						unsigned long ldigit;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (mpz_cmp_ui(&self->mpz, (unsigned long int)0) < 0) {
 | 
						if (mpz_cmp_ui(&self->mpz, (unsigned long int)0) < 0) {
 | 
				
			||||||
		PyErr_SetString(PyExc_ValueError,
 | 
							PyErr_SetString(PyExc_ValueError,
 | 
				
			||||||
				"mpz.binary() arg must be >= 0");
 | 
									"mpz.binary() arg must be >= 0");
 | 
				
			||||||
| 
						 | 
					@ -1493,13 +1440,13 @@ mpz_binary(mpzobject *self, PyObject *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef mpz_methods[] = {
 | 
					static PyMethodDef mpz_methods[] = {
 | 
				
			||||||
#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
					#ifdef MPZ_CONVERSIONS_AS_METHODS
 | 
				
			||||||
	{"int",			mpz_int},
 | 
						{"int",			mpz_int,   METH_NOARGS},
 | 
				
			||||||
	{"long",		mpz_long},
 | 
						{"long",		mpz_long,  METH_NOARGS},
 | 
				
			||||||
	{"float",		mpz_float},
 | 
						{"float",		mpz_float, METH_NOARGS},
 | 
				
			||||||
	{"hex",			mpz_hex},
 | 
						{"hex",			mpz_hex,   METH_NOARGS},
 | 
				
			||||||
	{"oct",			mpz_oct},
 | 
						{"oct",			mpz_oct,   METH_NOARGS},
 | 
				
			||||||
#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
					#endif /* def MPZ_CONVERSIONS_AS_METHODS */
 | 
				
			||||||
	{"binary",		(PyCFunction)mpz_binary},
 | 
						{"binary",		(PyCFunction)mpz_binary, METH_NOARGS},
 | 
				
			||||||
	{NULL,			NULL}		/* sentinel */
 | 
						{NULL,			NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -120,7 +120,7 @@ nis_match (PyObject *self, PyObject *args)
 | 
				
			||||||
	PyObject *res;
 | 
						PyObject *res;
 | 
				
			||||||
	int fix;
 | 
						int fix;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "(t#s)", &key, &keylen, &map))
 | 
						if (!PyArg_ParseTuple(args, "t#s:match", &key, &keylen, &map))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if ((err = yp_get_default_domain(&domain)) != 0)
 | 
						if ((err = yp_get_default_domain(&domain)) != 0)
 | 
				
			||||||
		return nis_error(err);
 | 
							return nis_error(err);
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ nis_cat (PyObject *self, PyObject *args)
 | 
				
			||||||
	PyObject *dict;
 | 
						PyObject *dict;
 | 
				
			||||||
	int err;
 | 
						int err;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s", &map))
 | 
						if (!PyArg_ParseTuple(args, "s:cat", &map))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if ((err = yp_get_default_domain(&domain)) != 0)
 | 
						if ((err = yp_get_default_domain(&domain)) != 0)
 | 
				
			||||||
		return nis_error(err);
 | 
							return nis_error(err);
 | 
				
			||||||
| 
						 | 
					@ -338,13 +338,11 @@ nis_maplist (void)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
nis_maps (PyObject *self, PyObject *args)
 | 
					nis_maps (PyObject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	nismaplist *maps;
 | 
						nismaplist *maps;
 | 
				
			||||||
	PyObject *list;
 | 
						PyObject *list;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!PyArg_NoArgs(args))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if ((maps = nis_maplist ()) == NULL)
 | 
						if ((maps = nis_maplist ()) == NULL)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if ((list = PyList_New(0)) == NULL)
 | 
						if ((list = PyList_New(0)) == NULL)
 | 
				
			||||||
| 
						 | 
					@ -364,9 +362,9 @@ nis_maps (PyObject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef nis_methods[] = {
 | 
					static PyMethodDef nis_methods[] = {
 | 
				
			||||||
	{"match",	nis_match, METH_OLDARGS},
 | 
						{"match",	nis_match, METH_VARARGS},
 | 
				
			||||||
	{"cat",		nis_cat, METH_OLDARGS},
 | 
						{"cat",		nis_cat, METH_VARARGS},
 | 
				
			||||||
	{"maps",	nis_maps, METH_OLDARGS},
 | 
						{"maps",	(PyCFunction)nis_maps, METH_NOARGS},
 | 
				
			||||||
	{NULL,		NULL}		 /* Sentinel */
 | 
						{NULL,		NULL}		 /* Sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -84,7 +84,7 @@ pwd_getpwuid(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int uid;
 | 
						int uid;
 | 
				
			||||||
	struct passwd *p;
 | 
						struct passwd *p;
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &uid))
 | 
						if (!PyArg_ParseTuple(args, "i:getpwuid", &uid))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if ((p = getpwuid(uid)) == NULL) {
 | 
						if ((p = getpwuid(uid)) == NULL) {
 | 
				
			||||||
		PyErr_SetString(PyExc_KeyError, "getpwuid(): uid not found");
 | 
							PyErr_SetString(PyExc_KeyError, "getpwuid(): uid not found");
 | 
				
			||||||
| 
						 | 
					@ -103,7 +103,7 @@ pwd_getpwnam(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	char *name;
 | 
						char *name;
 | 
				
			||||||
	struct passwd *p;
 | 
						struct passwd *p;
 | 
				
			||||||
	if (!PyArg_Parse(args, "s", &name))
 | 
						if (!PyArg_ParseTuple(args, "s:getpwnam", &name))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if ((p = getpwnam(name)) == NULL) {
 | 
						if ((p = getpwnam(name)) == NULL) {
 | 
				
			||||||
		PyErr_SetString(PyExc_KeyError, "getpwnam(): name not found");
 | 
							PyErr_SetString(PyExc_KeyError, "getpwnam(): name not found");
 | 
				
			||||||
| 
						 | 
					@ -146,8 +146,8 @@ pwd_getpwall(PyObject *self)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef pwd_methods[] = {
 | 
					static PyMethodDef pwd_methods[] = {
 | 
				
			||||||
	{"getpwuid",	pwd_getpwuid, METH_OLDARGS, pwd_getpwuid__doc__},
 | 
						{"getpwuid",	pwd_getpwuid, METH_VARARGS, pwd_getpwuid__doc__},
 | 
				
			||||||
	{"getpwnam",	pwd_getpwnam, METH_OLDARGS, pwd_getpwnam__doc__},
 | 
						{"getpwnam",	pwd_getpwnam, METH_VARARGS, pwd_getpwnam__doc__},
 | 
				
			||||||
#ifdef HAVE_GETPWENT
 | 
					#ifdef HAVE_GETPWENT
 | 
				
			||||||
	{"getpwall",	(PyCFunction)pwd_getpwall,
 | 
						{"getpwall",	(PyCFunction)pwd_getpwall,
 | 
				
			||||||
		METH_NOARGS,  pwd_getpwall__doc__},
 | 
							METH_NOARGS,  pwd_getpwall__doc__},
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -583,7 +583,7 @@ regex_match(PyObject *self, PyObject *args)
 | 
				
			||||||
	PyObject *pat, *string;
 | 
						PyObject *pat, *string;
 | 
				
			||||||
	PyObject *tuple, *v;
 | 
						PyObject *tuple, *v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "(SS)", &pat, &string))
 | 
						if (!PyArg_ParseTuple(args, "SS:match", &pat, &string))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (update_cache(pat) < 0)
 | 
						if (update_cache(pat) < 0)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -601,7 +601,7 @@ regex_search(PyObject *self, PyObject *args)
 | 
				
			||||||
	PyObject *pat, *string;
 | 
						PyObject *pat, *string;
 | 
				
			||||||
	PyObject *tuple, *v;
 | 
						PyObject *tuple, *v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "(SS)", &pat, &string))
 | 
						if (!PyArg_ParseTuple(args, "SS:search", &pat, &string))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (update_cache(pat) < 0)
 | 
						if (update_cache(pat) < 0)
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -617,7 +617,7 @@ static PyObject *
 | 
				
			||||||
regex_set_syntax(PyObject *self, PyObject *args)
 | 
					regex_set_syntax(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int syntax;
 | 
						int syntax;
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &syntax))
 | 
						if (!PyArg_ParseTuple(args, "i:set_syntax", &syntax))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	syntax = re_set_syntax(syntax);
 | 
						syntax = re_set_syntax(syntax);
 | 
				
			||||||
	/* wipe the global pattern cache */
 | 
						/* wipe the global pattern cache */
 | 
				
			||||||
| 
						 | 
					@ -629,10 +629,8 @@ regex_set_syntax(PyObject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
regex_get_syntax(PyObject *self, PyObject *args)
 | 
					regex_get_syntax(PyObject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	return PyInt_FromLong((long)re_syntax);
 | 
						return PyInt_FromLong((long)re_syntax);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -640,10 +638,10 @@ regex_get_syntax(PyObject *self, PyObject *args)
 | 
				
			||||||
static struct PyMethodDef regex_global_methods[] = {
 | 
					static struct PyMethodDef regex_global_methods[] = {
 | 
				
			||||||
	{"compile",	regex_compile, METH_VARARGS},
 | 
						{"compile",	regex_compile, METH_VARARGS},
 | 
				
			||||||
	{"symcomp",	regex_symcomp, METH_VARARGS},
 | 
						{"symcomp",	regex_symcomp, METH_VARARGS},
 | 
				
			||||||
	{"match",	regex_match, METH_OLDARGS},
 | 
						{"match",	regex_match, METH_VARARGS},
 | 
				
			||||||
	{"search",	regex_search, METH_OLDARGS},
 | 
						{"search",	regex_search, METH_VARARGS},
 | 
				
			||||||
	{"set_syntax",	regex_set_syntax, METH_OLDARGS},
 | 
						{"set_syntax",	regex_set_syntax, METH_VARARGS},
 | 
				
			||||||
	{"get_syntax",  regex_get_syntax, METH_OLDARGS},
 | 
						{"get_syntax",  (PyCFunction)regex_get_syntax, METH_NOARGS},
 | 
				
			||||||
	{NULL,		NULL}		     /* sentinel */
 | 
						{NULL,		NULL}		     /* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -236,7 +236,7 @@ sizeofimage(PyObject *self, PyObject *args)
 | 
				
			||||||
	IMAGE image;
 | 
						IMAGE image;
 | 
				
			||||||
	FILE *inf;
 | 
						FILE *inf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s", &name))
 | 
						if (!PyArg_ParseTuple(args, "s:sizeofimage", &name))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inf = fopen(name, "rb");
 | 
						inf = fopen(name, "rb");
 | 
				
			||||||
| 
						 | 
					@ -275,7 +275,7 @@ longimagedata(PyObject *self, PyObject *args)
 | 
				
			||||||
	int rlebuflen;
 | 
						int rlebuflen;
 | 
				
			||||||
	PyObject *rv = NULL;
 | 
						PyObject *rv = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s", &name))
 | 
						if (!PyArg_ParseTuple(args, "s:longimagedata", &name))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	inf = fopen(name,"rb");
 | 
						inf = fopen(name,"rb");
 | 
				
			||||||
| 
						 | 
					@ -570,8 +570,8 @@ longstoimage(PyObject *self, PyObject *args)
 | 
				
			||||||
	int rlebuflen, goodwrite;
 | 
						int rlebuflen, goodwrite;
 | 
				
			||||||
	PyObject *retval = NULL;
 | 
						PyObject *retval = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "(s#iiis)", &lptr, &len, &xsize, &ysize, &zsize,
 | 
						if (!PyArg_ParseTuple(args, "s#iiis:longstoimage", &lptr, &len,
 | 
				
			||||||
			 &name))
 | 
								      &xsize, &ysize, &zsize, &name))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	goodwrite = 1;
 | 
						goodwrite = 1;
 | 
				
			||||||
| 
						 | 
					@ -734,7 +734,7 @@ ttob(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int order, oldorder;
 | 
						int order, oldorder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &order))
 | 
						if (!PyArg_ParseTuple(args, "i:ttob", &order))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	oldorder = reverse_order;
 | 
						oldorder = reverse_order;
 | 
				
			||||||
	reverse_order = order;
 | 
						reverse_order = order;
 | 
				
			||||||
| 
						 | 
					@ -743,10 +743,10 @@ ttob(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef
 | 
					static PyMethodDef
 | 
				
			||||||
rgbimg_methods[] = {
 | 
					rgbimg_methods[] = {
 | 
				
			||||||
	{"sizeofimage",	   sizeofimage, METH_OLDARGS},
 | 
						{"sizeofimage",	   sizeofimage, METH_VARARGS},
 | 
				
			||||||
	{"longimagedata",  longimagedata, METH_OLDARGS},
 | 
						{"longimagedata",  longimagedata, METH_VARARGS},
 | 
				
			||||||
	{"longstoimage",   longstoimage, METH_OLDARGS},
 | 
						{"longstoimage",   longstoimage, METH_VARARGS},
 | 
				
			||||||
	{"ttob",	   ttob, METH_OLDARGS},
 | 
						{"ttob",	   ttob, METH_VARARGS},
 | 
				
			||||||
	{NULL,             NULL}	     /* sentinel */
 | 
						{NULL,             NULL}	     /* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -463,7 +463,7 @@ rotorobj_encrypt(Rotorobj *self, PyObject *args)
 | 
				
			||||||
	PyObject *rtn = NULL;
 | 
						PyObject *rtn = NULL;
 | 
				
			||||||
	char *tmp;
 | 
						char *tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s#", &string, &len))
 | 
						if (!PyArg_ParseTuple(args, "s#:encrypt", &string, &len))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
						if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
				
			||||||
		PyErr_NoMemory();
 | 
							PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -485,7 +485,7 @@ rotorobj_encrypt_more(Rotorobj *self, PyObject *args)
 | 
				
			||||||
	PyObject *rtn = NULL;
 | 
						PyObject *rtn = NULL;
 | 
				
			||||||
	char *tmp;
 | 
						char *tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s#", &string, &len))
 | 
						if (!PyArg_ParseTuple(args, "s#:encrypt_more", &string, &len))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
						if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
				
			||||||
		PyErr_NoMemory();
 | 
							PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -507,7 +507,7 @@ rotorobj_decrypt(Rotorobj *self, PyObject *args)
 | 
				
			||||||
	PyObject *rtn = NULL;
 | 
						PyObject *rtn = NULL;
 | 
				
			||||||
	char *tmp;
 | 
						char *tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s#", &string, &len))
 | 
						if (!PyArg_ParseTuple(args, "s#:decrypt", &string, &len))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
						if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
				
			||||||
		PyErr_NoMemory();
 | 
							PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -529,7 +529,7 @@ rotorobj_decrypt_more(Rotorobj *self, PyObject *args)
 | 
				
			||||||
	PyObject *rtn = NULL;
 | 
						PyObject *rtn = NULL;
 | 
				
			||||||
	char *tmp;
 | 
						char *tmp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, "s#", &string, &len))
 | 
						if (!PyArg_ParseTuple(args, "s#:decrypt_more", &string, &len))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
						if (!(tmp = PyMem_NEW(char, len+5))) {
 | 
				
			||||||
		PyErr_NoMemory();
 | 
							PyErr_NoMemory();
 | 
				
			||||||
| 
						 | 
					@ -558,10 +558,10 @@ rotorobj_setkey(Rotorobj *self, PyObject *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct PyMethodDef
 | 
					static struct PyMethodDef
 | 
				
			||||||
rotorobj_methods[] = {
 | 
					rotorobj_methods[] = {
 | 
				
			||||||
	{"encrypt",	(PyCFunction)rotorobj_encrypt, METH_OLDARGS},
 | 
						{"encrypt",	(PyCFunction)rotorobj_encrypt, METH_VARARGS},
 | 
				
			||||||
	{"encryptmore",	(PyCFunction)rotorobj_encrypt_more, METH_OLDARGS},
 | 
						{"encryptmore",	(PyCFunction)rotorobj_encrypt_more, METH_VARARGS},
 | 
				
			||||||
	{"decrypt",	(PyCFunction)rotorobj_decrypt, METH_OLDARGS},
 | 
						{"decrypt",	(PyCFunction)rotorobj_decrypt, METH_VARARGS},
 | 
				
			||||||
	{"decryptmore",	(PyCFunction)rotorobj_decrypt_more, METH_OLDARGS},
 | 
						{"decryptmore",	(PyCFunction)rotorobj_decrypt_more, METH_VARARGS},
 | 
				
			||||||
	{"setkey",	(PyCFunction)rotorobj_setkey, METH_VARARGS},
 | 
						{"setkey",	(PyCFunction)rotorobj_setkey, METH_VARARGS},
 | 
				
			||||||
	{NULL,		NULL}		/* sentinel */
 | 
						{NULL,		NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -611,7 +611,7 @@ rotor_rotor(PyObject *self, PyObject *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static struct PyMethodDef
 | 
					static struct PyMethodDef
 | 
				
			||||||
rotor_methods[] = {
 | 
					rotor_methods[] = {
 | 
				
			||||||
	{"newrotor",  rotor_rotor, 1},
 | 
						{"newrotor",  rotor_rotor, METH_VARARGS},
 | 
				
			||||||
	{NULL,        NULL}		     /* sentinel */
 | 
						{NULL,        NULL}		     /* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -149,7 +149,7 @@ static PyObject *
 | 
				
			||||||
signal_alarm(PyObject *self, PyObject *args)
 | 
					signal_alarm(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int t;
 | 
						int t;
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &t))
 | 
						if (!PyArg_ParseTuple(args, "i:alarm", &t))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	/* alarm() returns the number of seconds remaining */
 | 
						/* alarm() returns the number of seconds remaining */
 | 
				
			||||||
	return PyInt_FromLong((long)alarm(t));
 | 
						return PyInt_FromLong((long)alarm(t));
 | 
				
			||||||
| 
						 | 
					@ -192,7 +192,7 @@ signal_signal(PyObject *self, PyObject *args)
 | 
				
			||||||
	int sig_num;
 | 
						int sig_num;
 | 
				
			||||||
	PyObject *old_handler;
 | 
						PyObject *old_handler;
 | 
				
			||||||
	void (*func)(int);
 | 
						void (*func)(int);
 | 
				
			||||||
	if (!PyArg_Parse(args, "(iO)", &sig_num, &obj))
 | 
						if (!PyArg_ParseTuple(args, "iO:signal", &sig_num, &obj))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
#ifdef WITH_THREAD
 | 
					#ifdef WITH_THREAD
 | 
				
			||||||
	if (PyThread_get_thread_ident() != main_thread) {
 | 
						if (PyThread_get_thread_ident() != main_thread) {
 | 
				
			||||||
| 
						 | 
					@ -248,7 +248,7 @@ signal_getsignal(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int sig_num;
 | 
						int sig_num;
 | 
				
			||||||
	PyObject *old_handler;
 | 
						PyObject *old_handler;
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &sig_num))
 | 
						if (!PyArg_ParseTuple(args, "i:getsignal", &sig_num))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (sig_num < 1 || sig_num >= NSIG) {
 | 
						if (sig_num < 1 || sig_num >= NSIG) {
 | 
				
			||||||
		PyErr_SetString(PyExc_ValueError,
 | 
							PyErr_SetString(PyExc_ValueError,
 | 
				
			||||||
| 
						 | 
					@ -274,16 +274,16 @@ anything else -- the callable Python object used as a handler\n\
 | 
				
			||||||
/* List of functions defined in the module */
 | 
					/* List of functions defined in the module */
 | 
				
			||||||
static PyMethodDef signal_methods[] = {
 | 
					static PyMethodDef signal_methods[] = {
 | 
				
			||||||
#ifdef HAVE_ALARM
 | 
					#ifdef HAVE_ALARM
 | 
				
			||||||
	{"alarm",	        signal_alarm, METH_OLDARGS, alarm_doc},
 | 
						{"alarm",	        signal_alarm, METH_VARARGS, alarm_doc},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	{"signal",	        signal_signal, METH_OLDARGS, signal_doc},
 | 
						{"signal",	        signal_signal, METH_VARARGS, signal_doc},
 | 
				
			||||||
	{"getsignal",	        signal_getsignal, METH_OLDARGS, getsignal_doc},
 | 
						{"getsignal",	        signal_getsignal, METH_VARARGS, getsignal_doc},
 | 
				
			||||||
#ifdef HAVE_PAUSE
 | 
					#ifdef HAVE_PAUSE
 | 
				
			||||||
	{"pause",	        (PyCFunction)signal_pause,
 | 
						{"pause",	        (PyCFunction)signal_pause,
 | 
				
			||||||
	 METH_NOARGS,pause_doc},
 | 
						 METH_NOARGS,pause_doc},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	{"default_int_handler", signal_default_int_handler, 
 | 
						{"default_int_handler", signal_default_int_handler, 
 | 
				
			||||||
	 METH_OLDARGS, default_int_handler_doc},
 | 
						 METH_VARARGS, default_int_handler_doc},
 | 
				
			||||||
	{NULL,			NULL}		/* sentinel */
 | 
						{NULL,			NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -58,7 +58,7 @@ newsadobject(PyObject *args)
 | 
				
			||||||
	char* opendev;
 | 
						char* opendev;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Check arg for r/w/rw */
 | 
						/* Check arg for r/w/rw */
 | 
				
			||||||
	if (!PyArg_Parse(args, "s", &mode))
 | 
						if (!PyArg_ParseTuple(args, "s", &mode))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	if (strcmp(mode, "r") == 0)
 | 
						if (strcmp(mode, "r") == 0)
 | 
				
			||||||
		imode = 0;
 | 
							imode = 0;
 | 
				
			||||||
| 
						 | 
					@ -133,7 +133,7 @@ sad_read(sadobject *self, PyObject *args)
 | 
				
			||||||
	char *cp;
 | 
						char *cp;
 | 
				
			||||||
	PyObject *rv;
 | 
						PyObject *rv;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
        if (!PyArg_Parse(args, "i", &size))
 | 
					        if (!PyArg_ParseTuple(args, "i:read", &size))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	rv = PyString_FromStringAndSize(NULL, size);
 | 
						rv = PyString_FromStringAndSize(NULL, size);
 | 
				
			||||||
	if (rv == NULL)
 | 
						if (rv == NULL)
 | 
				
			||||||
| 
						 | 
					@ -169,7 +169,7 @@ sad_write(sadobject *self, PyObject *args)
 | 
				
			||||||
        char *cp;
 | 
					        char *cp;
 | 
				
			||||||
	int count, size;
 | 
						int count, size;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
        if (!PyArg_Parse(args, "s#", &cp, &size))
 | 
					        if (!PyArg_ParseTuple(args, "s#:write", &cp, &size))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	count = write(self->x_fd, cp, size);
 | 
						count = write(self->x_fd, cp, size);
 | 
				
			||||||
| 
						 | 
					@ -188,12 +188,10 @@ sad_write(sadobject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_getinfo(sadobject *self, PyObject *args)
 | 
					sad_getinfo(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	sadstatusobject *rv;
 | 
						sadstatusobject *rv;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (!(rv = sads_alloc()))
 | 
						if (!(rv = sads_alloc()))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,12 +220,10 @@ sad_setinfo(sadobject *self, sadstatusobject *arg)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_ibufcount(sadobject *self, PyObject *args)
 | 
					sad_ibufcount(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	audio_info_t ai;
 | 
						audio_info_t ai;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) {
 | 
						if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) {
 | 
				
			||||||
		PyErr_SetFromErrno(SunAudioError);
 | 
							PyErr_SetFromErrno(SunAudioError);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -236,12 +232,10 @@ sad_ibufcount(sadobject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_obufcount(sadobject *self, PyObject *args)
 | 
					sad_obufcount(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	audio_info_t ai;
 | 
						audio_info_t ai;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) {
 | 
						if (ioctl(self->x_fd, AUDIO_GETINFO, &ai) < 0) {
 | 
				
			||||||
		PyErr_SetFromErrno(SunAudioError);
 | 
							PyErr_SetFromErrno(SunAudioError);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -254,11 +248,8 @@ sad_obufcount(sadobject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_drain(sadobject *self, PyObject *args)
 | 
					sad_drain(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (ioctl(self->x_fd, AUDIO_DRAIN, 0) < 0) {
 | 
						if (ioctl(self->x_fd, AUDIO_DRAIN, 0) < 0) {
 | 
				
			||||||
		PyErr_SetFromErrno(SunAudioError);
 | 
							PyErr_SetFromErrno(SunAudioError);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -269,12 +260,10 @@ sad_drain(sadobject *self, PyObject *args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef SOLARIS
 | 
					#ifdef SOLARIS
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_getdev(sadobject *self, PyObject *args)
 | 
					sad_getdev(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct audio_device ad;
 | 
						struct audio_device ad;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (ioctl(self->x_fd, AUDIO_GETDEV, &ad) < 0) {
 | 
						if (ioctl(self->x_fd, AUDIO_GETDEV, &ad) < 0) {
 | 
				
			||||||
		PyErr_SetFromErrno(SunAudioError);
 | 
							PyErr_SetFromErrno(SunAudioError);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -284,11 +273,8 @@ sad_getdev(sadobject *self, PyObject *args)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_flush(sadobject *self, PyObject *args)
 | 
					sad_flush(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    
 | 
					 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (ioctl(self->x_fd, I_FLUSH, FLUSHW) < 0) {
 | 
						if (ioctl(self->x_fd, I_FLUSH, FLUSHW) < 0) {
 | 
				
			||||||
		PyErr_SetFromErrno(SunAudioError);
 | 
							PyErr_SetFromErrno(SunAudioError);
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
| 
						 | 
					@ -298,11 +284,9 @@ sad_flush(sadobject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_close(sadobject *self, PyObject *args)
 | 
					sad_close(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
	if (self->x_fd >= 0) {
 | 
						if (self->x_fd >= 0) {
 | 
				
			||||||
		close(self->x_fd);
 | 
							close(self->x_fd);
 | 
				
			||||||
		self->x_fd = -1;
 | 
							self->x_fd = -1;
 | 
				
			||||||
| 
						 | 
					@ -312,30 +296,27 @@ sad_close(sadobject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
sad_fileno(sadobject *self, PyObject *args)
 | 
					sad_fileno(sadobject *self)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!PyArg_Parse(args, ""))
 | 
					 | 
				
			||||||
		return NULL;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return PyInt_FromLong(self->x_fd);
 | 
						return PyInt_FromLong(self->x_fd);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef sad_methods[] = {
 | 
					static PyMethodDef sad_methods[] = {
 | 
				
			||||||
        { "read",	(PyCFunction)sad_read, METH_OLDARGS },
 | 
					        { "read",	(PyCFunction)sad_read, METH_VARARGS },
 | 
				
			||||||
        { "write",	(PyCFunction)sad_write, METH_OLDARGS },
 | 
					        { "write",	(PyCFunction)sad_write, METH_VARARGS },
 | 
				
			||||||
        { "ibufcount",	(PyCFunction)sad_ibufcount, METH_OLDARGS },
 | 
					        { "ibufcount",	(PyCFunction)sad_ibufcount, METH_NOARGS },
 | 
				
			||||||
        { "obufcount",	(PyCFunction)sad_obufcount, METH_OLDARGS },
 | 
					        { "obufcount",	(PyCFunction)sad_obufcount, METH_NOARGS },
 | 
				
			||||||
#define CTL_METHODS 4
 | 
					#define CTL_METHODS 4
 | 
				
			||||||
        { "getinfo",	(PyCFunction)sad_getinfo, METH_OLDARGS },
 | 
					        { "getinfo",	(PyCFunction)sad_getinfo, METH_NOARGS },
 | 
				
			||||||
        { "setinfo",	(PyCFunction)sad_setinfo, METH_OLDARGS },
 | 
					        { "setinfo",	(PyCFunction)sad_setinfo, METH_O},
 | 
				
			||||||
        { "drain",	(PyCFunction)sad_drain, METH_OLDARGS },
 | 
					        { "drain",	(PyCFunction)sad_drain, METH_NOARGS },
 | 
				
			||||||
        { "flush",	(PyCFunction)sad_flush, METH_OLDARGS },
 | 
					        { "flush",	(PyCFunction)sad_flush, METH_NOARGS },
 | 
				
			||||||
#ifdef SOLARIS
 | 
					#ifdef SOLARIS
 | 
				
			||||||
	{ "getdev",	(PyCFunction)sad_getdev, METH_OLDARGS },
 | 
						{ "getdev",	(PyCFunction)sad_getdev, METH_NOARGS },
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
        { "close",	(PyCFunction)sad_close, METH_OLDARGS },
 | 
					        { "close",	(PyCFunction)sad_close, METH_NOARGS },
 | 
				
			||||||
	{ "fileno",     (PyCFunction)sad_fileno, METH_OLDARGS },
 | 
						{ "fileno",     (PyCFunction)sad_fileno, METH_NOARGS },
 | 
				
			||||||
	{NULL,		NULL}		/* sentinel */
 | 
						{NULL,		NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -465,7 +446,7 @@ sadopen(PyObject *self, PyObject *args)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
static PyMethodDef sunaudiodev_methods[] = {
 | 
					static PyMethodDef sunaudiodev_methods[] = {
 | 
				
			||||||
    { "open", sadopen, METH_OLDARGS },
 | 
					    { "open", sadopen, METH_VARARGS },
 | 
				
			||||||
    { 0, 0 },
 | 
					    { 0, 0 },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -54,14 +54,10 @@ lock_dealloc(lockobject *self)
 | 
				
			||||||
static PyObject *
 | 
					static PyObject *
 | 
				
			||||||
lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
 | 
					lock_PyThread_acquire_lock(lockobject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (args != NULL) {
 | 
						if (!PyArg_ParseTuple(args, "|i:acquire", &i))
 | 
				
			||||||
		if (!PyArg_Parse(args, "i", &i))
 | 
					 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	else
 | 
					 | 
				
			||||||
		i = 1;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Py_BEGIN_ALLOW_THREADS
 | 
						Py_BEGIN_ALLOW_THREADS
 | 
				
			||||||
	i = PyThread_acquire_lock(self->lock_lock, i);
 | 
						i = PyThread_acquire_lock(self->lock_lock, i);
 | 
				
			||||||
| 
						 | 
					@ -127,9 +123,9 @@ Return whether the lock is in the locked state.";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static PyMethodDef lock_methods[] = {
 | 
					static PyMethodDef lock_methods[] = {
 | 
				
			||||||
	{"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, 
 | 
						{"acquire_lock", (PyCFunction)lock_PyThread_acquire_lock, 
 | 
				
			||||||
	 METH_OLDARGS, acquire_doc},
 | 
						 METH_VARARGS, acquire_doc},
 | 
				
			||||||
	{"acquire",      (PyCFunction)lock_PyThread_acquire_lock, 
 | 
						{"acquire",      (PyCFunction)lock_PyThread_acquire_lock, 
 | 
				
			||||||
	 METH_OLDARGS, acquire_doc},
 | 
						 METH_VARARGS, acquire_doc},
 | 
				
			||||||
	{"release_lock", (PyCFunction)lock_PyThread_release_lock, 
 | 
						{"release_lock", (PyCFunction)lock_PyThread_release_lock, 
 | 
				
			||||||
	 METH_NOARGS, release_doc},
 | 
						 METH_NOARGS, release_doc},
 | 
				
			||||||
	{"release",      (PyCFunction)lock_PyThread_release_lock, 
 | 
						{"release",      (PyCFunction)lock_PyThread_release_lock, 
 | 
				
			||||||
| 
						 | 
					@ -279,7 +275,7 @@ static PyObject *
 | 
				
			||||||
thread_PyThread_exit_prog(PyObject *self, PyObject *args)
 | 
					thread_PyThread_exit_prog(PyObject *self, PyObject *args)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int sts;
 | 
						int sts;
 | 
				
			||||||
	if (!PyArg_Parse(args, "i", &sts))
 | 
						if (!PyArg_ParseTuple(args, "i:exit_prog", &sts))
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	Py_Exit(sts); /* Calls PyThread_exit_prog(sts) or _PyThread_exit_prog(sts) */
 | 
						Py_Exit(sts); /* Calls PyThread_exit_prog(sts) or _PyThread_exit_prog(sts) */
 | 
				
			||||||
	for (;;) { } /* Should not be reached */
 | 
						for (;;) { } /* Should not be reached */
 | 
				
			||||||
| 
						 | 
					@ -339,7 +335,8 @@ static PyMethodDef thread_methods[] = {
 | 
				
			||||||
	{"get_ident",		(PyCFunction)thread_get_ident, 
 | 
						{"get_ident",		(PyCFunction)thread_get_ident, 
 | 
				
			||||||
	 METH_NOARGS, get_ident_doc},
 | 
						 METH_NOARGS, get_ident_doc},
 | 
				
			||||||
#ifndef NO_EXIT_PROG
 | 
					#ifndef NO_EXIT_PROG
 | 
				
			||||||
	{"exit_prog",		(PyCFunction)thread_PyThread_exit_prog},
 | 
						{"exit_prog",		(PyCFunction)thread_PyThread_exit_prog,
 | 
				
			||||||
 | 
						 METH_VARARGS},
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
	{NULL,			NULL}		/* sentinel */
 | 
						{NULL,			NULL}		/* sentinel */
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue