[Python-checkins] python/dist/src/Objects listobject.c,2.119,2.120

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
2002年7月16日 13:10:25 -0700


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv28787
Modified Files:
	listobject.c 
Log Message:
Whitespace normalization.
Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.119
retrieving revision 2.120
diff -C2 -d -r2.119 -r2.120
*** listobject.c	16 Jul 2002 20:07:32 -0000	2.119
--- listobject.c	16 Jul 2002 20:10:23 -0000	2.120
***************
*** 1921,1925 ****
 	PyType_GenericAlloc,			/* tp_alloc */
 	PyType_GenericNew,			/* tp_new */
! 	PyObject_GC_Del, 		/* tp_free */
 };
 
--- 1921,1925 ----
 	PyType_GenericAlloc,			/* tp_alloc */
 	PyType_GenericNew,			/* tp_new */
! 	PyObject_GC_Del,			/* tp_free */
 };
 
***************
*** 2014,2019 ****
 
 typedef struct {
! PyObject_HEAD
! long it_index;
 	PyListObject *it_seq; /* Set to NULL when iterator is exhausted */
 } listiterobject;
--- 2014,2019 ----
 
 typedef struct {
! 	PyObject_HEAD
! 	long it_index;
 	PyListObject *it_seq; /* Set to NULL when iterator is exhausted */
 } listiterobject;
***************
*** 2024,2041 ****
 list_iter(PyObject *seq)
 {
! listiterobject *it;
 
! if (!PyList_Check(seq)) {
! PyErr_BadInternalCall();
! return NULL;
! }
! it = PyObject_GC_New(listiterobject, &PyListIter_Type);
! if (it == NULL)
! return NULL;
! it->it_index = 0;
! Py_INCREF(seq);
! it->it_seq = (PyListObject *)seq;
! _PyObject_GC_TRACK(it);
! return (PyObject *)it;
 }
 
--- 2024,2041 ----
 list_iter(PyObject *seq)
 {
! 	listiterobject *it;
 
! 	if (!PyList_Check(seq)) {
! 		PyErr_BadInternalCall();
! 		return NULL;
! 	}
! 	it = PyObject_GC_New(listiterobject, &PyListIter_Type);
! 	if (it == NULL)
! 		return NULL;
! 	it->it_index = 0;
! 	Py_INCREF(seq);
! 	it->it_seq = (PyListObject *)seq;
! 	_PyObject_GC_TRACK(it);
! 	return (PyObject *)it;
 }
 
***************
*** 2043,2049 ****
 listiter_dealloc(listiterobject *it)
 {
! _PyObject_GC_UNTRACK(it);
 	Py_XDECREF(it->it_seq);
! PyObject_GC_Del(it);
 }
 
--- 2043,2049 ----
 listiter_dealloc(listiterobject *it)
 {
! 	_PyObject_GC_UNTRACK(it);
 	Py_XDECREF(it->it_seq);
! 	PyObject_GC_Del(it);
 }
 
***************
*** 2053,2057 ****
 	if (it->it_seq == NULL)
 		return 0;
! return visit((PyObject *)it->it_seq, arg);
 }
 
--- 2053,2057 ----
 	if (it->it_seq == NULL)
 		return 0;
! 	return visit((PyObject *)it->it_seq, arg);
 }
 
***************
*** 2060,2065 ****
 listiter_getiter(PyObject *it)
 {
! Py_INCREF(it);
! return it;
 }
 
--- 2060,2065 ----
 listiter_getiter(PyObject *it)
 {
! 	Py_INCREF(it);
! 	return it;
 }
 
***************
*** 2067,2127 ****
 listiter_next(listiterobject *it)
 {
! PyListObject *seq;
! PyObject *item;
 
 	assert(it != NULL);
! seq = it->it_seq;
 	if (seq == NULL)
 		return NULL;
! assert(PyList_Check(seq));
 
! if (it->it_index < PyList_GET_SIZE(seq)) {
 		item = PyList_GET_ITEM(seq, it->it_index);
 		++it->it_index;
! Py_INCREF(item);
! return item;
! }
 
 	Py_DECREF(seq);
 	it->it_seq = NULL;
! return NULL;
 }
 
 PyTypeObject PyListIter_Type = {
! PyObject_HEAD_INIT(&PyType_Type)
! 0, /* ob_size */
! "listiterator", /* tp_name */
! sizeof(listiterobject), /* tp_basicsize */
! 0, /* tp_itemsize */
! /* methods */
! (destructor)listiter_dealloc, /* tp_dealloc */
! 0, /* tp_print */
! 0, /* tp_getattr */
! 0, /* tp_setattr */
! 0, /* tp_compare */
! 0, /* tp_repr */
! 0, /* tp_as_number */
! 0, /* tp_as_sequence */
! 0, /* tp_as_mapping */
! 0, /* tp_hash */
! 0, /* tp_call */
! 0, /* tp_str */
! PyObject_GenericGetAttr, /* tp_getattro */
! 0, /* tp_setattro */
! 0, /* tp_as_buffer */
! Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
! 0, /* tp_doc */
! (traverseproc)listiter_traverse, /* tp_traverse */
! 0, /* tp_clear */
! 0, /* tp_richcompare */
! 0, /* tp_weaklistoffset */
! (getiterfunc)listiter_getiter, /* tp_iter */
! (iternextfunc)listiter_next, /* tp_iternext */
 	0,					/* tp_methods */
! 0, /* tp_members */
! 0, /* tp_getset */
! 0, /* tp_base */
! 0, /* tp_dict */
! 0, /* tp_descr_get */
! 0, /* tp_descr_set */
 };
--- 2067,2127 ----
 listiter_next(listiterobject *it)
 {
! 	PyListObject *seq;
! 	PyObject *item;
 
 	assert(it != NULL);
! 	seq = it->it_seq;
 	if (seq == NULL)
 		return NULL;
! 	assert(PyList_Check(seq));
 
! 	if (it->it_index < PyList_GET_SIZE(seq)) {
 		item = PyList_GET_ITEM(seq, it->it_index);
 		++it->it_index;
! 		Py_INCREF(item);
! 		return item;
! 	}
 
 	Py_DECREF(seq);
 	it->it_seq = NULL;
! 	return NULL;
 }
 
 PyTypeObject PyListIter_Type = {
! 	PyObject_HEAD_INIT(&PyType_Type)
! 	0,					/* ob_size */
! 	"listiterator",				/* tp_name */
! 	sizeof(listiterobject),			/* tp_basicsize */
! 	0,					/* tp_itemsize */
! 	/* methods */
! 	(destructor)listiter_dealloc,		/* tp_dealloc */
! 	0,					/* tp_print */
! 	0,					/* tp_getattr */
! 	0,					/* tp_setattr */
! 	0,					/* tp_compare */
! 	0,					/* tp_repr */
! 	0,					/* tp_as_number */
! 	0,					/* tp_as_sequence */
! 	0,					/* tp_as_mapping */
! 	0,					/* tp_hash */
! 	0,					/* tp_call */
! 	0,					/* tp_str */
! 	PyObject_GenericGetAttr,		/* tp_getattro */
! 	0,					/* tp_setattro */
! 	0,					/* tp_as_buffer */
! 	Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */
! 	0,					/* tp_doc */
! 	(traverseproc)listiter_traverse,	/* tp_traverse */
! 	0,					/* tp_clear */
! 	0,					/* tp_richcompare */
! 	0,					/* tp_weaklistoffset */
! 	(getiterfunc)listiter_getiter,		/* tp_iter */
! 	(iternextfunc)listiter_next,		/* tp_iternext */
 	0,					/* tp_methods */
! 	0,					/* tp_members */
! 	0,					/* tp_getset */
! 	0,					/* tp_base */
! 	0,					/* tp_dict */
! 	0,					/* tp_descr_get */
! 	0,					/* tp_descr_set */
 };

AltStyle によって変換されたページ (->オリジナル) /