[Python-checkins] CVS: python/dist/src/Objects dictobject.c,2.66,2.67

Moshe Zadka python-dev@python.org
Thu, 30 Nov 2000 11:30:23 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv5381/Objects

Modified Files:
	dictobject.c 
Log Message:
Backing out my changes. 
Improved version coming soon to a Source Forge near you!


Index: dictobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/dictobject.c,v
retrieving revision 2.66
retrieving revision 2.67
diff -C2 -r2.66 -r2.67
*** dictobject.c	2000/11/30 12:31:00	2.66
--- dictobject.c	2000/11/30 19:30:19	2.67
***************
*** 710,782 ****
  
  static PyObject *
- dict_firstkey(register dictobject *mp, PyObject *args)
- {
- 	register int i;
- 
- 	if (!PyArg_NoArgs(args))
- 		return NULL;
- 	if (mp->ma_used == 0) {
- 		PyErr_SetString(PyExc_ValueError, "empty dictionary");
- 		return NULL;
- 	}
- 	for (i = 0; i < mp->ma_size; i++) {
- 		if (mp->ma_table[i].me_value != NULL) {
- 			PyObject *key = mp->ma_table[i].me_key;
- 			Py_INCREF(key);
- 			return key;
- 		}
- 	}
- }
- 
- static PyObject *
- dict_firstvalue(register dictobject *mp, PyObject *args)
- {
- 	register int i;
- 
- 	if (!PyArg_NoArgs(args))
- 		return NULL;
- 	if (mp->ma_used == 0) {
- 		PyErr_SetString(PyExc_ValueError, "empty dictionary");
- 		return NULL;
- 	}
- 	for (i = 0; i < mp->ma_size; i++) {
- 		if (mp->ma_table[i].me_value != NULL) {
- 			PyObject *value = mp->ma_table[i].me_value;
- 			Py_INCREF(value);
- 			return value;
- 		}
- 	}
- }
- 
- static PyObject *
- dict_firstitem(register dictobject *mp, PyObject *args)
- {
- 	register int i;
- 
- 	if (!PyArg_NoArgs(args))
- 		return NULL;
- 	if (mp->ma_used == 0) {
- 		PyErr_SetString(PyExc_ValueError, "empty dictionary");
- 		return NULL;
- 	}
- 	for (i = 0; i < mp->ma_size; i++) {
- 		if (mp->ma_table[i].me_value != NULL) {
- 			PyObject *key = mp->ma_table[i].me_key;
- 			PyObject *value = mp->ma_table[i].me_value;
- 			PyObject *item = PyTuple_New(2);
- 			if (item == NULL) {
- 				return NULL;
- 			}
- 			Py_INCREF(key);
- 			PyTuple_SetItem(item, 0, key);
- 			Py_INCREF(value);
- 			PyTuple_SetItem(item, 1, value);
- 			return item;
- 		}
- 	}
- }
- 
- 
- static PyObject *
  dict_keys(register dictobject *mp, PyObject *args)
  {
--- 710,713 ----
***************
*** 1232,1238 ****
  	{"items",	(PyCFunction)dict_items},
  	{"values",	(PyCFunction)dict_values},
- 	{"firstkey",	(PyCFunction)dict_firstkey},
- 	{"firstitem",	(PyCFunction)dict_firstitem},
- 	{"firstvalue",	(PyCFunction)dict_firstvalue},
  	{"update",	(PyCFunction)dict_update},
  	{"clear",	(PyCFunction)dict_clear},
--- 1163,1166 ----