Lines Matching refs:dp
52 dbmobject *dp; in newdbmobject() local
54 dp = PyObject_New(dbmobject, &Dbmtype); in newdbmobject()
55 if (dp == NULL) in newdbmobject()
57 dp->di_size = -1; in newdbmobject()
58 if ( (dp->di_dbm = dbm_open(file, flags, mode)) == 0 ) { in newdbmobject()
60 Py_DECREF(dp); in newdbmobject()
63 return (PyObject *)dp; in newdbmobject()
69 dbm_dealloc(register dbmobject *dp) in dbm_dealloc() argument
71 if ( dp->di_dbm ) in dbm_dealloc()
72 dbm_close(dp->di_dbm); in dbm_dealloc()
73 PyObject_Del(dp); in dbm_dealloc()
77 dbm_length(dbmobject *dp) in dbm_length() argument
79 if (dp->di_dbm == NULL) { in dbm_length()
83 if ( dp->di_size < 0 ) { in dbm_length()
88 for ( key=dbm_firstkey(dp->di_dbm); key.dptr; in dbm_length()
89 key = dbm_nextkey(dp->di_dbm)) in dbm_length()
91 dp->di_size = size; in dbm_length()
93 return dp->di_size; in dbm_length()
97 dbm_subscript(dbmobject *dp, register PyObject *key) in dbm_subscript() argument
106 check_dbmobject_open(dp); in dbm_subscript()
107 drec = dbm_fetch(dp->di_dbm, krec); in dbm_subscript()
113 if ( dbm_error(dp->di_dbm) ) { in dbm_subscript()
114 dbm_clearerr(dp->di_dbm); in dbm_subscript()
122 dbm_ass_sub(dbmobject *dp, PyObject *v, PyObject *w) in dbm_ass_sub() argument
133 if (dp->di_dbm == NULL) { in dbm_ass_sub()
137 dp->di_size = -1; in dbm_ass_sub()
139 if ( dbm_delete(dp->di_dbm, krec) < 0 ) { in dbm_ass_sub()
140 dbm_clearerr(dp->di_dbm); in dbm_ass_sub()
152 if ( dbm_store(dp->di_dbm, krec, drec, DBM_REPLACE) < 0 ) { in dbm_ass_sub()
153 dbm_clearerr(dp->di_dbm); in dbm_ass_sub()
159 if ( dbm_error(dp->di_dbm) ) { in dbm_ass_sub()
160 dbm_clearerr(dp->di_dbm); in dbm_ass_sub()
168 dbm_contains(register dbmobject *dp, PyObject *v) in dbm_contains() argument
180 if (dp->di_dbm == NULL) { in dbm_contains()
184 val = dbm_fetch(dp->di_dbm, key); in dbm_contains()
208 dbm__close(register dbmobject *dp, PyObject *unused) in dbm__close() argument
210 if (dp->di_dbm) in dbm__close()
211 dbm_close(dp->di_dbm); in dbm__close()
212 dp->di_dbm = NULL; in dbm__close()
218 dbm_keys(register dbmobject *dp, PyObject *unused) in dbm_keys() argument
224 check_dbmobject_open(dp); in dbm_keys()
228 for (key = dbm_firstkey(dp->di_dbm); key.dptr; in dbm_keys()
229 key = dbm_nextkey(dp->di_dbm)) { in dbm_keys()
246 dbm_has_key(register dbmobject *dp, PyObject *args) in dbm_has_key() argument
256 check_dbmobject_open(dp); in dbm_has_key()
257 val = dbm_fetch(dp->di_dbm, key); in dbm_has_key()
262 dbm_get(register dbmobject *dp, PyObject *args) in dbm_get() argument
274 check_dbmobject_open(dp); in dbm_get()
275 val = dbm_fetch(dp->di_dbm, key); in dbm_get()
285 dbm_setdefault(register dbmobject *dp, PyObject *args) in dbm_setdefault() argument
297 check_dbmobject_open(dp); in dbm_setdefault()
298 val = dbm_fetch(dp->di_dbm, key); in dbm_setdefault()
310 if (dbm_store(dp->di_dbm, key, val, DBM_INSERT) < 0) { in dbm_setdefault()
311 dbm_clearerr(dp->di_dbm); in dbm_setdefault()
336 dbm_getattr(dbmobject *dp, char *name) in dbm_getattr() argument
338 return Py_FindMethod(dbm_methods, (PyObject *)dp, name); in dbm_getattr()