Skip to content

Commit

Permalink
Simplify giflib version specific conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandro Santilli committed May 14, 2015
1 parent e952e7c commit f3a241f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
4 changes: 3 additions & 1 deletion NEWS
@@ -1,4 +1,6 @@
0.4.7 - 2125-MM-DD
0.4.7 - 2015-05-DD

* Restore support for giflib 4.1.x

0.4.6 - 2015-05-14

Expand Down
36 changes: 6 additions & 30 deletions src/libming.h
Expand Up @@ -75,38 +75,14 @@ typedef unsigned char BOOL;
#include <unistd.h>
#endif

#ifdef HAVE_GIF_LIB_H
#include <gif_lib.h>
#endif

#ifndef __has_attribute
#define __has_attribute(x) 0
#endif

#if (defined(__GNUC__)) || __has_attribute(unused)
#define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
#else
#define UNUSED(x) UNUSED_ ## x
#endif

#if GIFLIB_MAJOR < 5
#define GIFLIB5_ONLY(x) UNUSED(x)
#else
#define GIFLIB5_ONLY(x) x
#endif

#if GIFLIB_GIFERRORSTRING
static void
PrintGifError(int GIFLIB5_ONLY(errorCode))
{
#if GIFLIB_MAJOR < 5
fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString());
#else
fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(errorCode));
#endif
}
# if GIFLIB_MAJOR < 5
# define PrintGifError(x) fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString())
# else
# define PrintGifError(x) fprintf(stderr, "\nGIF-LIB error: %s.\n", GifErrorString(x))
# endif
#else
#define PrintGifError(x) PrintGifError()
# define PrintGifError(x) PrintGifError()
#endif

#endif /* SWF_LIBMING_H_INCLUDED */

0 comments on commit f3a241f

Please sign in to comment.