diff options
author | Werner Koch <[email protected]> | 2014-08-22 07:26:28 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-08-25 14:37:45 +0000 |
commit | 8d57ce619aa49862caeee30181fbbd9c76846554 (patch) | |
tree | ddf93e6b991db0c1ac1c6d2ff9401eb40fcf317e /src/estream.c | |
parent | Add missing redefine macros to cleanup the external symbols. (diff) | |
download | libgpg-error-8d57ce619aa49862caeee30181fbbd9c76846554.tar.gz libgpg-error-8d57ce619aa49862caeee30181fbbd9c76846554.zip |
Fix some minor estream things.
* m4/estream.m4: Check for memrchr.
* src/estream.c (memrchr) [!HAVE_MEMRCHR]: New.
* src/init.c: Include estream.h
(real_init): Init estream.
Diffstat (limited to 'src/estream.c')
-rw-r--r-- | src/estream.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/src/estream.c b/src/estream.c index 8476f8b..e7a81e8 100644 --- a/src/estream.c +++ b/src/estream.c @@ -103,16 +103,8 @@ # include "../common/util.h" #endif -#ifndef HAVE_MKSTEMP -int mkstemp (char *template); -#endif - -#ifndef HAVE_MEMRCHR -void *memrchr (const void *block, int c, size_t size); -#endif - -#include <estream.h> -#include <estream-printf.h> +#include "estream.h" +#include "estream-printf.h" @@ -340,6 +332,20 @@ map_w32_to_errno (DWORD w32_err) } #endif /*HAVE_W32_SYSTEM*/ +/* Replacement fucntions. */ + +#ifndef HAVE_MEMRCHR +static void * +memrchr (const void *buffer, int c, size_t n) +{ + const unsigned char *p = buffer; + + for (p += n; n ; n--) + if (*--p == c) + return (void *)p; + return NULL; +} +#endif /*HAVE_MEMRCHR*/ /* |