--- libaitsync/src/aitsync.c 2012/11/13 14:19:39 1.4 +++ libaitsync/src/aitsync.c 2014/02/04 16:39:00 1.5.2.1 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsync.c,v 1.4 2012/11/13 14:19:39 misho Exp $ +* $Id: aitsync.c,v 1.5.2.1 2014/02/04 16:39:00 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Copyright 2004 - 2014 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -65,21 +65,21 @@ func_comp(sync_tag_t const *t1, sync_tag_t const *t2) */ // sync_GetErrno() Get error code of last operation -inline int +int sync_GetErrno() { return sync_Errno; } // sync_GetError() Get error text of last operation -inline const char * +const char * sync_GetError() { return sync_Error; } // sync_SetErr() Set error to variables for internal use!!! -inline void +void sync_SetErr(int eno, char *estr, ...) { va_list lst; @@ -257,7 +257,7 @@ syncDelta(const char *csInput, const char *csSig, cons tags[i] = NULL_TAG; /* build second index from signature blocks */ - tag_table = (sync_tag_t*) calloc(cnt, sizeof(sync_tag_t)); + tag_table = (sync_tag_t*) e_calloc(cnt, sizeof(sync_tag_t)); if (!tag_table) { LOGERR; munmap(chunks, sb.st_size); @@ -281,7 +281,7 @@ syncDelta(const char *csInput, const char *csSig, cons inf = sync_Open(csInput, O_RDONLY, 0); if (inf == -1) { - free(tag_table); + e_free(tag_table); munmap(chunks, sb.st_size); return inf; } @@ -291,7 +291,7 @@ syncDelta(const char *csInput, const char *csSig, cons f = sync_Open(csDelta, O_WRONLY, 0); if (f == -1) { sync_Close(inf); - free(tag_table); + e_free(tag_table); munmap(chunks, sb.st_size); return f; } @@ -425,7 +425,7 @@ end: if (compress & 1) unlink(szTemp); sync_Close(inf); - free(tag_table); + e_free(tag_table); munmap(chunks, sb.st_size); return ret; } @@ -503,16 +503,14 @@ syncPatch(const char *csInput, const char *csDelta, co inf = sync_Open(csInput, O_RDONLY, 0); if (inf == -1) { - if (pieces) - free(pieces); + e_free(pieces); munmap(delta, sb.st_size); return inf; } outf = sync_Open(csPatch, O_WRONLY, 0); if (outf == -1) { sync_Close(inf); - if (pieces) - free(pieces); + e_free(pieces); munmap(delta, sb.st_size); return outf; } @@ -616,8 +614,7 @@ syncPatch(const char *csInput, const char *csDelta, co end: sync_Close(inf); sync_Close(outf); - if (pieces) - free(pieces); + e_free(pieces); munmap(delta, sb.st_size); return ret; }