summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2023-09-05 17:35:55 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2023-09-05 17:45:43 -0700
commit7f60f3428aa21d5d643eb75bfd9417cfabf48970 (patch)
tree57a8de98ab7e41bbe17950658eaab25438ef32c1
parent2695ccda5df58af60ebb15bb17f1570437554adb (diff)
Explicitly mark non-static symbols as export or hidden
Hides private API from external linkage Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--include/X11/xpm.h8
-rw-r--r--src/RdFToI.c2
-rw-r--r--src/WrFFrI.c2
-rw-r--r--src/XpmI.h70
-rw-r--r--test/rgb.c2
5 files changed, 45 insertions, 39 deletions
diff --git a/include/X11/xpm.h b/include/X11/xpm.h
index f108f1f..a490b52 100644
--- a/include/X11/xpm.h
+++ b/include/X11/xpm.h
@@ -73,6 +73,7 @@
# ifdef AMIGA
# include "amigax.h"
# else /* not AMIGA */
+# include <X11/Xfuncproto.h>
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif /* not AMIGA */
@@ -275,7 +276,12 @@ typedef struct {
/* macros for forward declarations of functions with prototypes */
-#define FUNC(f, t, p) extern t f p
+#ifndef _X_EXPORT
+# define _X_EXPORT
+# define _X_HIDDEN
+#endif
+#define FUNC(f, t, p) extern _X_EXPORT t f p
+#define HFUNC(f, t, p) extern _X_HIDDEN t f p
#define LFUNC(f, t, p) static t f p
diff --git a/src/RdFToI.c b/src/RdFToI.c
index 28c0c33..0ce78cd 100644
--- a/src/RdFToI.c
+++ b/src/RdFToI.c
@@ -53,7 +53,7 @@
LFUNC(OpenReadFile, int, (const char *filename, xpmData *mdata));
LFUNC(xpmDataClose, void, (xpmData *mdata));
-FUNC(xpmPipeThrough, FILE*, (int fd,
+HFUNC(xpmPipeThrough, FILE*, (int fd,
const char *cmd,
const char *arg1,
const char *mode));
diff --git a/src/WrFFrI.c b/src/WrFFrI.c
index 6855c84..4c3ecac 100644
--- a/src/WrFFrI.c
+++ b/src/WrFFrI.c
@@ -315,7 +315,7 @@ WriteExtensions(
#ifndef NO_ZPIPE
-FUNC(xpmPipeThrough, FILE*, (int fd,
+HFUNC(xpmPipeThrough, FILE*, (int fd,
const char* cmd,
const char* arg1,
const char* mode));
diff --git a/src/XpmI.h b/src/XpmI.h
index 4ab48f2..ab7a680 100644
--- a/src/XpmI.h
+++ b/src/XpmI.h
@@ -151,7 +151,7 @@ typedef struct {
const char *Eoa; /* string ending assignment */
} xpmDataType;
-extern xpmDataType xpmDataTypes[];
+extern _X_HIDDEN xpmDataType xpmDataTypes[];
/*
* rgb values and ascii names (from rgb text file) rgb values,
@@ -165,7 +165,7 @@ typedef struct {
/* Maximum number of rgb mnemonics allowed in rgb text file. */
#define MAX_RGBNAMES 1024
-extern const char *xpmColorKeys[];
+extern _X_HIDDEN const char *xpmColorKeys[];
#define TRANSPARENT_COLOR "None" /* this must be a string! */
@@ -174,31 +174,31 @@ extern const char *xpmColorKeys[];
/* XPM internal routines */
-FUNC(xpmParseData, int, (xpmData *data, XpmImage *image, XpmInfo *info));
-FUNC(xpmParseDataAndCreate, int, (Display *display, xpmData *data,
+HFUNC(xpmParseData, int, (xpmData *data, XpmImage *image, XpmInfo *info));
+HFUNC(xpmParseDataAndCreate, int, (Display *display, xpmData *data,
XImage **image_return,
XImage **shapeimage_return,
XpmImage *image, XpmInfo *info,
XpmAttributes *attributes));
-FUNC(xpmFreeColorTable, void, (XpmColor *colorTable, int ncolors));
+HFUNC(xpmFreeColorTable, void, (XpmColor *colorTable, int ncolors));
-FUNC(xpmInitAttributes, void, (XpmAttributes *attributes));
+HFUNC(xpmInitAttributes, void, (XpmAttributes *attributes));
-FUNC(xpmInitXpmImage, void, (XpmImage *image));
+HFUNC(xpmInitXpmImage, void, (XpmImage *image));
-FUNC(xpmInitXpmInfo, void, (XpmInfo *info));
+HFUNC(xpmInitXpmInfo, void, (XpmInfo *info));
-FUNC(xpmSetInfoMask, void, (XpmInfo *info, XpmAttributes *attributes));
-FUNC(xpmSetInfo, void, (XpmInfo *info, XpmAttributes *attributes));
-FUNC(xpmSetAttributes, void, (XpmAttributes *attributes, XpmImage *image,
+HFUNC(xpmSetInfoMask, void, (XpmInfo *info, XpmAttributes *attributes));
+HFUNC(xpmSetInfo, void, (XpmInfo *info, XpmAttributes *attributes));
+HFUNC(xpmSetAttributes, void, (XpmAttributes *attributes, XpmImage *image,
XpmInfo *info));
#if !defined(FOR_MSW) && !defined(AMIGA)
-FUNC(xpmCreatePixmapFromImage, void, (Display *display, Drawable d,
+HFUNC(xpmCreatePixmapFromImage, void, (Display *display, Drawable d,
XImage *ximage, Pixmap *pixmap_return));
-FUNC(xpmCreateImageFromPixmap, void, (Display *display, Pixmap pixmap,
+HFUNC(xpmCreateImageFromPixmap, void, (Display *display, Pixmap pixmap,
XImage **ximage_return,
unsigned int *width,
unsigned int *height));
@@ -218,10 +218,10 @@ typedef struct {
xpmHashAtom *atomTable;
} xpmHashTable;
-FUNC(xpmHashTableInit, int, (xpmHashTable *table));
-FUNC(xpmHashTableFree, void, (xpmHashTable *table));
-FUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s));
-FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));
+HFUNC(xpmHashTableInit, int, (xpmHashTable *table));
+HFUNC(xpmHashTableFree, void, (xpmHashTable *table));
+HFUNC(xpmHashSlot, xpmHashAtom *, (xpmHashTable *table, char *s));
+HFUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));
#if defined(_MSC_VER) && defined(_M_X64)
#define HashAtomData(i) ((void *)(long long)i)
@@ -234,45 +234,45 @@ FUNC(xpmHashIntern, int, (xpmHashTable *table, char *tag, void *data));
/* I/O utility */
-FUNC(xpmNextString, int, (xpmData *mdata));
-FUNC(xpmNextUI, int, (xpmData *mdata, unsigned int *ui_return));
-FUNC(xpmGetString, int, (xpmData *mdata, char **sptr, unsigned int *l));
+HFUNC(xpmNextString, int, (xpmData *mdata));
+HFUNC(xpmNextUI, int, (xpmData *mdata, unsigned int *ui_return));
+HFUNC(xpmGetString, int, (xpmData *mdata, char **sptr, unsigned int *l));
#define xpmGetC(mdata) \
((!mdata->type || mdata->type == XPMBUFFER) ? \
(*mdata->cptr++) : (getc(mdata->stream.file)))
-FUNC(xpmNextWord, unsigned int,
+HFUNC(xpmNextWord, unsigned int,
(xpmData *mdata, char *buf, unsigned int buflen));
-FUNC(xpmGetCmt, int, (xpmData *mdata, char **cmt));
-FUNC(xpmParseHeader, int, (xpmData *mdata));
-FUNC(xpmParseValues, int, (xpmData *data, unsigned int *width,
+HFUNC(xpmGetCmt, int, (xpmData *mdata, char **cmt));
+HFUNC(xpmParseHeader, int, (xpmData *mdata));
+HFUNC(xpmParseValues, int, (xpmData *data, unsigned int *width,
unsigned int *height, unsigned int *ncolors,
unsigned int *cpp, unsigned int *x_hotspot,
unsigned int *y_hotspot, unsigned int *hotspot,
unsigned int *extensions));
-FUNC(xpmParseColors, int, (xpmData *data, unsigned int ncolors,
+HFUNC(xpmParseColors, int, (xpmData *data, unsigned int ncolors,
unsigned int cpp, XpmColor **colorTablePtr,
xpmHashTable *hashtable));
-FUNC(xpmParseExtensions, int, (xpmData *data, XpmExtension **extensions,
+HFUNC(xpmParseExtensions, int, (xpmData *data, XpmExtension **extensions,
unsigned int *nextensions));
/* RGB utility */
-FUNC(xpmReadRgbNames, int, (const char *rgb_fname, xpmRgbName *rgbn));
-FUNC(xpmGetRgbName, char *, (xpmRgbName *rgbn, int rgbn_max,
+HFUNC(xpmReadRgbNames, int, (const char *rgb_fname, xpmRgbName *rgbn));
+HFUNC(xpmGetRgbName, char *, (xpmRgbName *rgbn, int rgbn_max,
int red, int green, int blue));
-FUNC(xpmFreeRgbNames, void, (xpmRgbName *rgbn, int rgbn_max));
+HFUNC(xpmFreeRgbNames, void, (xpmRgbName *rgbn, int rgbn_max));
#ifdef FOR_MSW
-FUNC(xpmGetRGBfromName,int, (char *name, int *r, int *g, int *b));
+HFUNC(xpmGetRGBfromName,int, (char *name, int *r, int *g, int *b));
#endif
#ifndef AMIGA
-FUNC(xpm_xynormalizeimagebits, void, (register unsigned char *bp,
+HFUNC(xpm_xynormalizeimagebits, void, (register unsigned char *bp,
register XImage *img));
-FUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp,
+HFUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp,
register XImage *img));
/*
@@ -320,7 +320,7 @@ FUNC(xpm_znormalizeimagebits, void, (register unsigned char *bp,
#endif /* not AMIGA */
#ifdef NEED_STRDUP
-FUNC(xpmstrdup, char *, (char *s1));
+HFUNC(xpmstrdup, char *, (char *s1));
#else
#undef xpmstrdup
#define xpmstrdup strdup
@@ -328,14 +328,14 @@ FUNC(xpmstrdup, char *, (char *s1));
#endif
#ifdef NEED_STRCASECMP
-FUNC(xpmstrcasecmp, int, (char *s1, char *s2));
+HFUNC(xpmstrcasecmp, int, (char *s1, char *s2));
#else
#undef xpmstrcasecmp
#define xpmstrcasecmp strcasecmp
#include <strings.h>
#endif
-FUNC(xpmatoui, unsigned int,
+HFUNC(xpmatoui, unsigned int,
(char *p, unsigned int l, unsigned int *ui_return));
#endif
diff --git a/test/rgb.c b/test/rgb.c
index a5ad583..7b19f79 100644
--- a/test/rgb.c
+++ b/test/rgb.c
@@ -23,7 +23,7 @@
#include "config.h"
-#include "../src/XpmI.h"
+#include "../src/rgb.c"
#include <glib.h>
/*