[Pkg-gnupg-commit] [libassuan] 89/437: * funopen.c (_assuan_funopen): Renamed from funopen, to keep the name space clean and avoid duplicate definitions if another library uses the same replacement. * assuan-defs.h (funopen): Renamed prototype and add a macro.

Eric Dorland eric at moszumanska.debian.org
Fri May 22 05:33:27 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository libassuan.

commit 16d5599ef42126a9f908fa31221a1bb8d4dbb2da
Author: Werner Koch <wk at gnupg.org>
Date:   Thu Dec 11 13:10:45 2003 +0000

    * funopen.c (_assuan_funopen): Renamed from funopen, to keep the
    name space clean and avoid duplicate definitions if another
    library uses the same replacement.
    * assuan-defs.h (funopen): Renamed prototype and add a macro.
---
 src/ChangeLog     |  7 +++++++
 src/assuan-defs.h | 10 ++++++----
 src/funopen.c     | 35 +++++++++++++++++++++++++++--------
 3 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index 5c456b8..542e6be 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2003-12-11  Werner Koch  <wk at gnupg.org>
+
+	* funopen.c (_assuan_funopen): Renamed from funopen, to keep the
+	name space clean and avoid duplicate definitions if another
+	library uses the same replacement.
+	* assuan-defs.h (funopen): Renamed prototype and add a macro.
+
 2003-12-08  Werner Koch  <wk at gnupg.org>
 
 	* TODO: Removed.
diff --git a/src/assuan-defs.h b/src/assuan-defs.h
index 1f7f1f0..e25fc6a 100644
--- a/src/assuan-defs.h
+++ b/src/assuan-defs.h
@@ -184,10 +184,12 @@ ssize_t _assuan_simple_write (ASSUAN_CONTEXT ctx, const void *buffer,
 
 #ifdef HAVE_FOPENCOOKIE
 /* We have to implement funopen in terms of glibc's fopencookie. */
-FILE *funopen(const void *cookie, cookie_read_function_t *readfn,
-              cookie_write_function_t *writefn,
-              cookie_seek_function_t *seekfn,
-              cookie_close_function_t *closefn);
+FILE *_assuan_funopen(void *cookie,
+                      cookie_read_function_t *readfn,
+                      cookie_write_function_t *writefn,
+                      cookie_seek_function_t *seekfn,
+                      cookie_close_function_t *closefn);
+#define funopen(a,r,w,s,c) _assuan_funopen ((a), (r), (w), (s), (c))
 #endif /*HAVE_FOPENCOOKIE*/
 
 #endif /*ASSUAN_DEFS_H*/
diff --git a/src/funopen.c b/src/funopen.c
index e768b05..47f3370 100644
--- a/src/funopen.c
+++ b/src/funopen.c
@@ -24,18 +24,37 @@
 
 #include <stdio.h>
 
+
+/* Replacement for the *BSD function:
+
+  FILE *funopen (void *cookie,
+                 int (*readfn)(void *, char *, int),
+                 int (*writefn)(void *, const char *, int),
+                 fpos_t (*seekfn)(void *, fpos_t, int),
+                 int (*closefn)(void *));
+
+  The functions to provide my either be NULL if not required or
+  similar to the unistd function with the exception of using the
+  cookie instead of the fiel descripor.
+*/
+
+
 #ifdef HAVE_FOPENCOOKIE
 FILE *
-funopen(const void *cookie, cookie_read_function_t *readfn,
-	cookie_write_function_t *writefn,
-	cookie_seek_function_t *seekfn,
-	cookie_close_function_t *closefn)
+_assuan_funopen(void *cookie,
+                cookie_read_function_t *readfn,
+                cookie_write_function_t *writefn,
+                cookie_seek_function_t *seekfn,
+                cookie_close_function_t *closefn)
 {
-  cookie_io_functions_t io = { read: readfn, write: writefn, 
-			       seek: seekfn,
-			       close: closefn };
+  cookie_io_functions_t io = { NULL };
+
+  io.read = readfn;
+  io.write = writefn;
+  io.seek = seekfn;
+  io.close = closefn;
 
-  return fopencookie ((void *) cookie,
+   return fopencookie (cookie,
 		      readfn ? ( writefn ? "rw" : "r" )
 		      : ( writefn ? "w" : ""), io);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/libassuan.git



More information about the Pkg-gnupg-commit mailing list