- Revision
- 11135
- Author
- vajda
- Date
- 2006-07-12 06:06:28 -0700 (Wed, 12 Jul 2006)
Log Message
- added support for logging UUIDs while they are generated, to replay later
Modified Paths
Diff
Modified: trunk/internal/chandlerdb/Makefile (11134 => 11135)
--- trunk/internal/chandlerdb/Makefile 2006-07-12 02:39:14 UTC (rev 11134) +++ trunk/internal/chandlerdb/Makefile 2006-07-12 13:06:28 UTC (rev 11135) @@ -1,5 +1,5 @@ -RELVER=0.6-$(BRANCH_REV_PREFIX)29 +RELVER=0.6-$(BRANCH_REV_PREFIX)30 CHANDLERDB=$(INTERNAL)/chandlerdb DB_VER=4.4 SRC=""
Modified: trunk/internal/chandlerdb/chandlerdb/util/c.c (11134 => 11135)
--- trunk/internal/chandlerdb/chandlerdb/util/c.c 2006-07-12 02:39:14 UTC (rev 11134) +++ trunk/internal/chandlerdb/chandlerdb/util/c.c 2006-07-12 13:06:28 UTC (rev 11135) @@ -68,7 +68,7 @@ return PyInt_FromLong(combine_longs(h0, h1)); } -static PyObject *useUUIDs(PyObject *self, PyObject *arg) +static PyObject *loadUUIDs(PyObject *self, PyObject *arg) { if (arg == Py_None) arg = NULL; @@ -77,11 +77,34 @@ PyErr_SetObject(PyExc_TypeError, arg); return NULL; } + + Py_XDECREF(inList); + + if (arg) + { + inList = PyList_GetSlice(arg, 0, PyList_Size(arg)); + PyList_Reverse(inList); + } else + inList = NULL; + + Py_RETURN_NONE; +} + +static PyObject *saveUUIDs(PyObject *self, PyObject *arg) +{ + if (arg == Py_None) + arg = NULL; + else if (!PyList_Check(arg)) + { + PyErr_SetObject(PyExc_TypeError, arg); + return NULL; + } + else Py_INCREF(arg); - Py_XDECREF(uuidList); - uuidList = arg; + Py_XDECREF(outList); + outList = arg; Py_RETURN_NONE; } @@ -92,8 +115,10 @@ { "issingleref", (PyCFunction) issingleref, METH_O, "isinstance(SingleRef)" }, { "_hash", (PyCFunction) hash, METH_VARARGS, "hash bytes" }, { "_combine", (PyCFunction) combine, METH_VARARGS, "combine two hashes" }, - { "useUUIDs", (PyCFunction) useUUIDs, METH_O, - "use a list of pre-generated UUIDs for debugging" }, + { "loadUUIDs", (PyCFunction) loadUUIDs, METH_O, + "use a list of pre-generated UUIDs, for debugging" }, + { "saveUUIDs", (PyCFunction) saveUUIDs, METH_O, + "use a list to save UUIDs as they are generated, for debugging" }, #ifdef WINDOWS { "openHFILE", (PyCFunction) openHFILE, METH_VARARGS, "open HFILE" }, { "closeHFILE", (PyCFunction) closeHFILE, METH_VARARGS, "close HFILE" },
Modified: trunk/internal/chandlerdb/chandlerdb/util/c.h (11134 => 11135)
--- trunk/internal/chandlerdb/chandlerdb/util/c.h 2006-07-12 02:39:14 UTC (rev 11134) +++ trunk/internal/chandlerdb/chandlerdb/util/c.h 2006-07-12 13:06:28 UTC (rev 11135) @@ -30,7 +30,7 @@ extern PyTypeObject *CPoint; extern PyTypeObject *CNode; extern PyTypeObject *SkipList; -extern PyObject *uuidList; +extern PyObject *inList, *outList; void PyDict_SetItemString_Int(PyObject *, char *, int);
Modified: trunk/internal/chandlerdb/chandlerdb/util/pyuuid.c (11134 => 11135)
--- trunk/internal/chandlerdb/chandlerdb/util/pyuuid.c 2006-07-12 02:39:14 UTC (rev 11134) +++ trunk/internal/chandlerdb/chandlerdb/util/pyuuid.c 2006-07-12 13:06:28 UTC (rev 11135) @@ -38,7 +38,7 @@ static PyObject *pop_NAME; int debug = 0; -PyObject *uuidList = NULL; +PyObject *inList, *outList = NULL; static PyMemberDef t_uuid_members[] = { { "_uuid", T_OBJECT, offsetof(t_uuid, uuid), READONLY, "UUID bytes" }, @@ -135,9 +135,9 @@ switch (len) { case 0: - if (uuidList) + if (inList) { - PyObject *u = PyObject_CallMethodObjArgs(uuidList, pop_NAME, NULL); + PyObject *u = PyObject_CallMethodObjArgs(inList, pop_NAME, NULL); if (!u) return -1; @@ -162,6 +162,8 @@ "an error occurred while generating new UUID"); return -1; } + else if (outList) + PyList_Append(outList, (PyObject *) self); break; case 16: case 22: @@ -312,7 +314,7 @@ PyModule_AddObject(m, "PyUUID_Make16", cobj); debug = !Py_OptimizeFlag; - uuidList = NULL; + inList = outList = NULL; } } }
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
