Mercurial > hg > cc > cirrus_work
changeset 257:3ac7e5ec07f9 default tip
renamed cpython class Cdb to CCdb to avoid name conflict with cdb.Cdb
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Thu, 23 Jan 2025 12:53:28 +0000 |
parents | cbcdabf6819d |
children | |
files | lib/python/cc/lmh/db.pyx |
diffstat | 1 files changed, 6 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/lib/python/cc/lmh/db.pyx Thu Jan 23 12:27:57 2025 +0000 +++ b/lib/python/cc/lmh/db.pyx Thu Jan 23 12:53:28 2025 +0000 @@ -6,30 +6,29 @@ cimport cdb import sys, timeit -cdef class Cdb: +cdef class CCdb: cdef cdb.Cdb* _c_cdb - def __cinit__(self): self._c_cdb = cdb.cdb_new() - cdef int find(self: Cdb, p: bytes): + cdef int find(self, p: bytes): return cdb.cdb_find(self._c_cdb, p, len(p)) - cdef char[::1] init(self: Cdb, fno: int): + cdef char[::1] init(self, fno: int): cdb.cdb_init(self._c_cdb,fno) cdef char[::1] _mview = <char[:cdb.cdb_msize():1]>(cdb.cdb_mmap()) return _mview probe: bytes = sys.argv[2].encode('utf8') -cdef Cdb CC +cdef CCdb CC -cdef Cdb testMe(): +cdef CCdb testMe(): global probe res: int print('testing...') - cd = Cdb() + cd = CCdb() with open(sys.argv[1],'rb') as dbf: mv = cd.init(dbf.fileno()) cdb.cdb_findstart(cd._c_cdb)