From: Michael Schroeder Date: Tue, 2 Apr 2013 11:12:26 +0000 (+0200) Subject: small cleanup X-Git-Tag: upstream/0.4.0~218 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=97aca861574d8124620fe967758fb1644869871d;p=platform%2Fupstream%2Flibsolv.git small cleanup --- diff --git a/ext/solv_xfopen.c b/ext/solv_xfopen.c index 337b015..a9a6e40 100644 --- a/ext/solv_xfopen.c +++ b/ext/solv_xfopen.c @@ -22,26 +22,27 @@ static FILE *cookieopen(void *cookie, const char *mode, ssize_t (*cwrite)(void *, const char *, size_t), int (*cclose)(void *)) { +#ifdef HAVE_FUNOPEN if (!cookie) return 0; -#ifdef HAVE_FUNOPEN return funopen(cookie, - (int (*)(void *, char *, int))(*mode == 'r' ? cread: NULL),/* readfn */ - (int (*)(void *, const char *, int))(*mode == 'w' ? cwrite : NULL), /* writefn */ - (fpos_t (*)(void *, fpos_t, int))NULL, /* seekfn */ + (int (*)(void *, char *, int))(*mode == 'r' ? cread : NULL), /* readfn */ + (int (*)(void *, const char *, int))(*mode == 'w' ? cwrite : NULL), /* writefn */ + (fpos_t (*)(void *, fpos_t, int))NULL, /* seekfn */ cclose ); #elif defined(HAVE_FOPENCOOKIE) - { - cookie_io_functions_t cio; - memset(&cio, 0, sizeof(cio)); - if (*mode == 'r') - cio.read = cread; - else if (*mode == 'w') - cio.write = cwrite; - cio.close = cclose; - return fopencookie(cookie, *mode == 'w' ? "w" : "r", cio); - } + cookie_io_functions_t cio; + + if (!cookie) + return 0; + memset(&cio, 0, sizeof(cio)); + if (*mode == 'r') + cio.read = cread; + else if (*mode == 'w') + cio.write = cwrite; + cio.close = cclose; + return fopencookie(cookie, *mode == 'w' ? "w" : "r", cio); #else # error Need to implement custom I/O #endif