mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-23 00:07:38 +00:00
cache sync: introduce BORG_NO_PYTHON
textshell edition
This commit is contained in:
parent
3c6372f841
commit
783a5926d6
2 changed files with 9 additions and 6 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
|
||||||
|
#define BORG_NO_PYTHON
|
||||||
|
|
||||||
#include "../../src/borg/_hashindex.c"
|
#include "../../src/borg/_hashindex.c"
|
||||||
#include "../../src/borg/cache_sync/cache_sync.c"
|
#include "../../src/borg/cache_sync/cache_sync.c"
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ typedef struct {
|
||||||
int lower_limit;
|
int lower_limit;
|
||||||
int upper_limit;
|
int upper_limit;
|
||||||
int min_empty;
|
int min_empty;
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
/* buckets may be backed by a Python buffer. If buckets_buffer.buf is NULL then this is not used. */
|
/* buckets may be backed by a Python buffer. If buckets_buffer.buf is NULL then this is not used. */
|
||||||
Py_buffer buckets_buffer;
|
Py_buffer buckets_buffer;
|
||||||
#endif
|
#endif
|
||||||
|
@ -108,7 +108,7 @@ static int hash_sizes[] = {
|
||||||
#define EPRINTF(msg, ...) fprintf(stderr, "hashindex: " msg "(%s)\n", ##__VA_ARGS__, strerror(errno))
|
#define EPRINTF(msg, ...) fprintf(stderr, "hashindex: " msg "(%s)\n", ##__VA_ARGS__, strerror(errno))
|
||||||
#define EPRINTF_PATH(path, msg, ...) fprintf(stderr, "hashindex: %s: " msg " (%s)\n", path, ##__VA_ARGS__, strerror(errno))
|
#define EPRINTF_PATH(path, msg, ...) fprintf(stderr, "hashindex: %s: " msg " (%s)\n", path, ##__VA_ARGS__, strerror(errno))
|
||||||
|
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
static HashIndex *hashindex_read(PyObject *file_py, int permit_compact);
|
static HashIndex *hashindex_read(PyObject *file_py, int permit_compact);
|
||||||
static void hashindex_write(HashIndex *index, PyObject *file_py);
|
static void hashindex_write(HashIndex *index, PyObject *file_py);
|
||||||
#endif
|
#endif
|
||||||
|
@ -126,7 +126,7 @@ static void hashindex_free(HashIndex *index);
|
||||||
static void
|
static void
|
||||||
hashindex_free_buckets(HashIndex *index)
|
hashindex_free_buckets(HashIndex *index)
|
||||||
{
|
{
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
if(index->buckets_buffer.buf) {
|
if(index->buckets_buffer.buf) {
|
||||||
PyBuffer_Release(&index->buckets_buffer);
|
PyBuffer_Release(&index->buckets_buffer);
|
||||||
} else
|
} else
|
||||||
|
@ -272,7 +272,7 @@ count_empty(HashIndex *index)
|
||||||
|
|
||||||
/* Public API */
|
/* Public API */
|
||||||
|
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
static HashIndex *
|
static HashIndex *
|
||||||
hashindex_read(PyObject *file_py, int permit_compact)
|
hashindex_read(PyObject *file_py, int permit_compact)
|
||||||
{
|
{
|
||||||
|
@ -457,7 +457,7 @@ hashindex_init(int capacity, int key_size, int value_size)
|
||||||
index->lower_limit = get_lower_limit(index->num_buckets);
|
index->lower_limit = get_lower_limit(index->num_buckets);
|
||||||
index->upper_limit = get_upper_limit(index->num_buckets);
|
index->upper_limit = get_upper_limit(index->num_buckets);
|
||||||
index->min_empty = get_min_empty(index->num_buckets);
|
index->min_empty = get_min_empty(index->num_buckets);
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
index->buckets_buffer.buf = NULL;
|
index->buckets_buffer.buf = NULL;
|
||||||
#endif
|
#endif
|
||||||
for(i = 0; i < capacity; i++) {
|
for(i = 0; i < capacity; i++) {
|
||||||
|
@ -473,7 +473,7 @@ hashindex_free(HashIndex *index)
|
||||||
free(index);
|
free(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Py_PYTHON_H
|
#ifndef BORG_NO_PYTHON
|
||||||
static void
|
static void
|
||||||
hashindex_write(HashIndex *index, PyObject *file_py)
|
hashindex_write(HashIndex *index, PyObject *file_py)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue