summaryrefslogtreecommitdiff
path: root/bsdiff.c
diff options
context:
space:
mode:
authorMatthew Endsley <mendsley@gmail.com>2012-05-11 21:21:32 -0700
committerMatthew Endsley <mendsley@gmail.com>2012-05-14 01:04:24 -0700
commit195b87c27ac6ffde9e1f010310a82add1fc4f67b (patch)
tree4d652bb5fe7b43335be24c02c64add11b5f06255 /bsdiff.c
parentfec949feb73ef5eb49dc3006612629b73c381acc (diff)
downloadbsdiff-195b87c27ac6ffde9e1f010310a82add1fc4f67b.tar.gz
adding BSDIFF_LIBRARY define to exclude main and friends
Diffstat (limited to 'bsdiff.c')
-rw-r--r--bsdiff.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/bsdiff.c b/bsdiff.c
index 59154c6..89bbb79 100644
--- a/bsdiff.c
+++ b/bsdiff.c
@@ -30,13 +30,9 @@ __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bsdiff/bsdiff.c,v 1.1 2005/08/06 01:59:05
#include <sys/types.h>
-#include <bzlib.h>
-#include <fcntl.h>
-#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
struct bsdiff_header
{
@@ -262,10 +258,6 @@ int bsdiff(uint8_t* old, off_t oldsize, uint8_t* new, off_t newsize, struct bsdi
uint8_t *db,*eb;
uint8_t buf[8 * 3];
- bz_stream bz2 = {0};
- int bz2err;
-
-
if(((I=malloc((oldsize+1)*sizeof(off_t)))==NULL) ||
((V=malloc((oldsize+1)*sizeof(off_t)))==NULL)) err(1,NULL);
@@ -407,6 +399,13 @@ int bsdiff(uint8_t* old, off_t oldsize, uint8_t* new, off_t newsize, struct bsdi
return 0;
}
+#if !defined(BSDIFF_LIBRARY)
+
+#include <bzlib.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <unistd.h>
+
static int bz2_write(struct bsdiff_compressor* compressor, const void* buffer, int size)
{
bz_stream* bz2;
@@ -546,3 +545,5 @@ int main(int argc,char *argv[])
return 0;
}
+
+#endif