src/atom.c
// handles complex version restricts, rather then glob matches
handles complex version restricts, rather then glob matches
handles complex version restricts rather then glob matches
static inline PyObject *
make_version_restrict(PyObject *inst, PyObject *op)
{
	PyObject *ver = PyObject_GetAttr(inst, pkgcore_atom_version);
	if(ver) {
		PyObject *tup = PyTuple_New(3);
		if(!tup)
			return NULL;
		Py_INCREF(op);
		PyTuple_SET_ITEM(tup, 0, op);
		PyTuple_SET_ITEM(tup, 1, ver);
		PyObject *rev;
		if(op == pkgcore_atom_op_droprev) {
			Py_INCREF(Py_None);
			rev = Py_None;
		} else if(!(rev = PyObject_GetAttr(inst, pkgcore_atom_revision))) {
			Py_DECREF(tup);
			return NULL;
		}
		PyTuple_SET_ITEM(tup, 2, rev);
		PyObject *kwds = NULL;
		if(!make_version_kwds(inst, &kwds)) {
			PyObject *ret = PyObject_Call(pkgcore_atom_VersionMatch,
				tup, kwds);
			Py_DECREF(tup);
			Py_XDECREF(kwds);
			return ret;
		}
		Py_DECREF(tup);
	}
	return NULL;
}
static inline PyObject * make_version_restrict ( PyObject * inst , PyObject * op ) { PyObject * ver = PyObject_GetAttr ( inst , pkgcore_atom_version ) ; if ( ver ) { PyObject * tup = PyTuple_New ( 3 ) ; if ( ! tup ) return NULL ; Py_INCREF ( op ) ; PyTuple_SET_ITEM ( tup , 0 , op ) ; PyTuple_SET_ITEM ( tup , 1 , ver ) ; PyObject * rev ; if ( op == pkgcore_atom_op_droprev ) { Py_INCREF ( Py_None ) ; rev = Py_None ; } else if ( ! ( rev = PyObject_GetAttr ( inst , pkgcore_atom_revision ) ) ) { Py_DECREF ( tup ) ; return NULL ; } PyTuple_SET_ITEM ( tup , 2 , rev ) ; PyObject * kwds = NULL ; if ( ! make_version_kwds ( inst , & kwds ) ) { PyObject * ret = PyObject_Call ( pkgcore_atom_VersionMatch , tup , kwds ) ; Py_DECREF ( tup ) ; Py_XDECREF ( kwds ) ; return ret ; } Py_DECREF ( tup ) ; } return NULL ; }
handles complex version restricts, rather then glob matches
handles complex version restricts rather then glob matches
// got our args, and kwds... // since we've been using SET_ITEM, and did _not_ incref op // (stole temporarily), we have to wipe it now for the decref. // since tup steals, that just wiped ver, and rev.