From eb4e8e74a27000c6965c5921f69823046e7fe2b6 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Wed, 7 Dec 2011 20:53:20 +0300 Subject: [PATCH 1/4] bdelta.h: make header C compatible Exportaged names follow C calling. It's easier to to pull library in in other languages. Before patch: $ nm libbdelta.so_ | grep bdelta_ 0000000000002a00 T _Z11bdelta_passPvj 00000000000022c0 T _Z15bdelta_done_algPv 00000000000022b0 T _Z15bdelta_getErrorPv 0000000000002220 T _Z15bdelta_getMatchPvjPjS0_S0_ 0000000000002190 T _Z15bdelta_init_algjjPFPvS_S_jjES_S_j After patch: $ nm libbdelta.so | grep bdelta_ 00000000000022e0 T bdelta_done_alg 00000000000022d0 T bdelta_getError 0000000000002240 T bdelta_getMatch 00000000000021b0 T bdelta_init_alg 0000000000002a20 T bdelta_pass Converted global constants to enum. Signed-off-by: Sergei Trofimovich --- trunk/src/bdelta.h | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/trunk/src/bdelta.h b/trunk/src/bdelta.h index 4a7ea40..03b102b 100644 --- a/trunk/src/bdelta.h +++ b/trunk/src/bdelta.h @@ -13,6 +13,10 @@ * Author: John Whitney */ +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + // Callback function must return a pointer to the data requested. // A "fill and forget" buffer is provided, but can be ignored, so // long as the data persists throughout the life of bdelta_pass(). @@ -31,7 +35,12 @@ void bdelta_getMatch(void *instance, unsigned matchNum, int bdelta_getError(void *instance); -const int +enum BDELTA_RESULT { BDELTA_OK = 0, BDELTA_MEM_ERROR = -1, - BDELTA_READ_ERROR = -2; + BDELTA_READ_ERROR = -2 +}; + +#ifdef __cplusplus +} +#endif // __cplusplus -- 1.7.8