| 244 | } |
| 245 | |
| 246 | int |
| 247 | OdbBackend_init(OdbBackend *self, PyObject *args, PyObject *kwds) |
| 248 | { |
| 249 | // Check input arguments |
| 250 | if (args && PyTuple_Size(args) > 0) { |
| 251 | PyErr_SetString(PyExc_TypeError, "OdbBackend takes no arguments"); |
| 252 | return -1; |
| 253 | } |
| 254 | |
| 255 | if (kwds && PyDict_Size(kwds) > 0) { |
| 256 | PyErr_SetString(PyExc_TypeError, "OdbBackend takes no keyword arguments"); |
| 257 | return -1; |
| 258 | } |
| 259 | |
| 260 | // Create the C backend |
| 261 | pgit_odb_backend *custom_backend = calloc(1, sizeof(pgit_odb_backend)); |
| 262 | if (custom_backend == NULL) { |
| 263 | PyErr_NoMemory(); |
| 264 | return -1; |
| 265 | } |
| 266 | custom_backend->backend.version = GIT_ODB_BACKEND_VERSION; |
| 267 | |
| 268 | // Fill the member methods |
| 269 | custom_backend->backend.free = pgit_odb_backend_free; |
| 270 | custom_backend->backend.read = pgit_odb_backend_read; |
| 271 | custom_backend->backend.read_prefix = pgit_odb_backend_read_prefix; |
| 272 | custom_backend->backend.read_header = pgit_odb_backend_read_header; |
| 273 | custom_backend->backend.write = pgit_odb_backend_write; |
| 274 | custom_backend->backend.exists = pgit_odb_backend_exists; |
| 275 | custom_backend->backend.exists_prefix = pgit_odb_backend_exists_prefix; |
| 276 | custom_backend->backend.refresh = pgit_odb_backend_refresh; |
| 277 | // custom_backend->backend.writepack = pgit_odb_backend_writepack; |
| 278 | // custom_backend->backend.freshen = pgit_odb_backend_freshen; |
| 279 | // custom_backend->backend.writestream = pgit_odb_backend_writestream; |
| 280 | // custom_backend->backend.readstream = pgit_odb_backend_readstream; |
| 281 | if (PyIter_Check((PyObject *)self)) |
| 282 | custom_backend->backend.foreach = pgit_odb_backend_foreach; |
| 283 | |
| 284 | // Cross reference (don't incref because it's something internal) |
| 285 | custom_backend->py_backend = (PyObject *)self; |
| 286 | self->odb_backend = (git_odb_backend *)custom_backend; |
| 287 | |
| 288 | return 0; |
| 289 | } |
| 290 | |
| 291 | void |
| 292 | OdbBackend_dealloc(OdbBackend *self) |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…