diff options
author | Matthew Endsley <mendsley@gmail.com> | 2012-05-11 21:21:32 -0700 |
---|---|---|
committer | Matthew Endsley <mendsley@gmail.com> | 2012-05-14 01:04:24 -0700 |
commit | 195b87c27ac6ffde9e1f010310a82add1fc4f67b (patch) | |
tree | 4d652bb5fe7b43335be24c02c64add11b5f06255 /bsdiff.c | |
parent | fec949feb73ef5eb49dc3006612629b73c381acc (diff) | |
download | bsdiff-195b87c27ac6ffde9e1f010310a82add1fc4f67b.tar.gz |
adding BSDIFF_LIBRARY define to exclude main and friends
Diffstat (limited to 'bsdiff.c')
-rw-r--r-- | bsdiff.c | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -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 |