Lines Matching refs:dp

61     dbmobject *dp;  in newdbmobject()  local
63 dp = PyObject_New(dbmobject, &Dbmtype); in newdbmobject()
64 if (dp == NULL) in newdbmobject()
66 dp->di_size = -1; in newdbmobject()
68 if ((dp->di_dbm = gdbm_open(file, 0, flags, mode, NULL)) == 0) { in newdbmobject()
73 Py_DECREF(dp); in newdbmobject()
76 return (PyObject *)dp; in newdbmobject()
82 dbm_dealloc(register dbmobject *dp) in dbm_dealloc() argument
84 if (dp->di_dbm) in dbm_dealloc()
85 gdbm_close(dp->di_dbm); in dbm_dealloc()
86 PyObject_Del(dp); in dbm_dealloc()
90 dbm_length(dbmobject *dp) in dbm_length() argument
92 if (dp->di_dbm == NULL) { in dbm_length()
96 if (dp->di_size < 0) { in dbm_length()
103 for (key=gdbm_firstkey(dp->di_dbm); key.dptr; in dbm_length()
104 key = gdbm_nextkey(dp->di_dbm,okey)) { in dbm_length()
109 dp->di_size = size; in dbm_length()
111 return dp->di_size; in dbm_length()
115 dbm_subscript(dbmobject *dp, register PyObject *key) in dbm_subscript() argument
123 if (dp->di_dbm == NULL) { in dbm_subscript()
128 drec = gdbm_fetch(dp->di_dbm, krec); in dbm_subscript()
140 dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w) in dbm_ass_sub() argument
149 if (dp->di_dbm == NULL) { in dbm_ass_sub()
154 dp->di_size = -1; in dbm_ass_sub()
156 if (gdbm_delete(dp->di_dbm, krec) < 0) { in dbm_ass_sub()
169 if (gdbm_store(dp->di_dbm, krec, drec, GDBM_REPLACE) < 0) { in dbm_ass_sub()
182 dbm_contains(register dbmobject *dp, PyObject *arg) in dbm_contains() argument
186 if ((dp)->di_dbm == NULL) { in dbm_contains()
199 return gdbm_exists(dp->di_dbm, key); in dbm_contains()
226 dbm_close(register dbmobject *dp, PyObject *unused) in dbm_close() argument
228 if (dp->di_dbm) in dbm_close()
229 gdbm_close(dp->di_dbm); in dbm_close()
230 dp->di_dbm = NULL; in dbm_close()
240 dbm_keys(register dbmobject *dp, PyObject *unused) in dbm_keys() argument
246 if (dp == NULL || !is_dbmobject(dp)) { in dbm_keys()
250 check_dbmobject_open(dp); in dbm_keys()
256 key = gdbm_firstkey(dp->di_dbm); in dbm_keys()
271 nextkey = gdbm_nextkey(dp->di_dbm, key); in dbm_keys()
283 dbm_has_key(register dbmobject *dp, PyObject *args) in dbm_has_key() argument
289 check_dbmobject_open(dp); in dbm_has_key()
290 return PyInt_FromLong((long) gdbm_exists(dp->di_dbm, key)); in dbm_has_key()
301 dbm_firstkey(register dbmobject *dp, PyObject *unused) in dbm_firstkey() argument
306 check_dbmobject_open(dp); in dbm_firstkey()
307 key = gdbm_firstkey(dp->di_dbm); in dbm_firstkey()
331 dbm_nextkey(register dbmobject *dp, PyObject *args) in dbm_nextkey() argument
338 check_dbmobject_open(dp); in dbm_nextkey()
339 nextkey = gdbm_nextkey(dp->di_dbm, key); in dbm_nextkey()
360 dbm_reorganize(register dbmobject *dp, PyObject *unused) in dbm_reorganize() argument
362 check_dbmobject_open(dp); in dbm_reorganize()
364 if (gdbm_reorganize(dp->di_dbm) < 0) { in dbm_reorganize()
381 dbm_sync(register dbmobject *dp, PyObject *unused) in dbm_sync() argument
383 check_dbmobject_open(dp); in dbm_sync()
384 gdbm_sync(dp->di_dbm); in dbm_sync()
401 dbm_getattr(dbmobject *dp, char *name) in dbm_getattr() argument
403 return Py_FindMethod(dbm_methods, (PyObject *)dp, name); in dbm_getattr()