mercurial/mpatch.h
author Maciej Fijalkowski <fijall@gmail.com>
Fri, 22 Jul 2016 17:28:05 +0200
changeset 29694 55dd12204b8e
parent 29693 b9b9f9a92481
child 29749 155f0cc3f813
permissions -rw-r--r--
mpatch: remove dependency on Python.h in mpatch.c Now all the CPython-related stuff are referenced only from mpatch_module.c with mpatch.c being freely usable from a future cffi module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29693
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
     1
#ifndef _HG_MPATCH_H_
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
     2
#define _HG_MPATCH_H_
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
     3
29694
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     4
extern char *mpatch_errors[];
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     5
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     6
#define MPATCH_ERR_NO_MEM -3
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     7
#define MPATCH_ERR_CANNOT_BE_DECODED -2
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     8
#define MPATCH_ERR_INVALID_PATCH -1
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
     9
29693
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    10
struct mpatch_frag {
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    11
	int start, end, len;
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    12
	const char *data;
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    13
};
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    14
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    15
struct mpatch_flist {
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    16
	struct mpatch_frag *base, *head, *tail;
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    17
};
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    18
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    19
int mpatch_decode(const char *bin, ssize_t len, struct mpatch_flist** res);
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    20
ssize_t mpatch_calcsize(ssize_t len, struct mpatch_flist *l);
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    21
void mpatch_lfree(struct mpatch_flist *a);
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    22
int mpatch_apply(char *buf, const char *orig, ssize_t len,
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    23
	struct mpatch_flist *l);
29694
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
    24
struct mpatch_flist *mpatch_fold(void *bins,
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
    25
	struct mpatch_flist* (*get_next_item)(void*, ssize_t),
55dd12204b8e mpatch: remove dependency on Python.h in mpatch.c
Maciej Fijalkowski <fijall@gmail.com>
parents: 29693
diff changeset
    26
	ssize_t start, ssize_t end);
29693
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    27
b9b9f9a92481 mpatch: split mpatch into two files
Maciej Fijalkowski <fijall@gmail.com>
parents:
diff changeset
    28
#endif