From 0493c7216dd39baeb420583be71af095576dbf74 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 11 Dec 2022 09:50:55 -0800 Subject: Mark more functions and variables static Stop exporting things that aren't used outside the file that defines them. Signed-off-by: Alan Coopersmith --- action.c | 4 +++- action.h | 2 -- expr.c | 6 +++--- expr.h | 17 ----------------- keytypes.c | 27 +++------------------------ listing.c | 2 +- misc.c | 2 +- misc.h | 6 ------ utils.c | 4 ++-- utils.h | 3 +-- vmod.c | 2 +- vmod.h | 7 ------- xkbcomp.c | 4 ++-- xkbcomp.h | 6 ------ xkbpath.c | 2 +- xkbpath.h | 2 -- 16 files changed, 18 insertions(+), 78 deletions(-) diff --git a/action.c b/action.c index 7c8074a..b921f0d 100644 --- a/action.c +++ b/action.c @@ -38,6 +38,8 @@ static Bool actionsInitialized; static ExprDef constTrue; static ExprDef constFalse; +static void ActionsInit(void); + /***====================================================================***/ static Bool @@ -1488,7 +1490,7 @@ SetActionField(XkbDescPtr xkb, /***====================================================================***/ -void +static void ActionsInit(void) { if (!actionsInitialized) diff --git a/action.h b/action.h index bd9273d..a431122 100644 --- a/action.h +++ b/action.h @@ -79,8 +79,6 @@ extern int SetActionField(XkbDescPtr /* xkb */ , ActionInfo ** /* info_rtrn */ ); -extern void ActionsInit(void); - extern LookupEntry ctrlNames[]; #endif /* ACTION_H */ diff --git a/expr.c b/expr.c index 4af45c3..b22bb66 100644 --- a/expr.c +++ b/expr.c @@ -94,7 +94,7 @@ exprOpText(unsigned type) return buf; } -char * +static char * exprTypeText(unsigned type) { static char buf[20]; @@ -208,7 +208,7 @@ RadioLookup(XPointer priv, return True; } -int +static int TableLookup(XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) { @@ -255,7 +255,7 @@ LookupModIndex(XPointer priv, val_rtrn); } -int +static int LookupModMask(XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) { diff --git a/expr.h b/expr.h index 163d474..b0b79dc 100644 --- a/expr.h +++ b/expr.h @@ -42,9 +42,6 @@ typedef Bool(*IdentLookupFunc) (XPointer /* priv */ , ExprResult * /* val_rtrn */ ); -extern char *exprTypeText(unsigned /* type */ - ); - extern int ExprResolveLhs(ExprDef * /* expr */ , ExprResult * /* elem_rtrn */ , ExprResult * /* field_rtrn */ , @@ -89,13 +86,6 @@ extern int SimpleLookup(XPointer /* priv */ , ExprResult * /* val_rtrn */ ); -extern int TableLookup(XPointer /* priv */ , - Atom /* elem */ , - Atom /* field */ , - unsigned /* type */ , - ExprResult * /* val_rtrn */ - ); - extern int LookupModIndex(XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , @@ -103,13 +93,6 @@ extern int LookupModIndex(XPointer /* priv */ , ExprResult * /* val_rtrn */ ); -extern int LookupModMask(XPointer /* priv */ , - Atom /* elem */ , - Atom /* field */ , - unsigned /* type */ , - ExprResult * /* val_rtrn */ - ); - extern int ExprResolveModIndex(ExprDef * /* expr */ , ExprResult * /* val_rtrn */ , IdentLookupFunc /* lookup */ , diff --git a/keytypes.c b/keytypes.c index 2dba53a..24ad6b1 100644 --- a/keytypes.c +++ b/keytypes.c @@ -92,27 +92,6 @@ Atom tok_KEYPAD; /***====================================================================***/ -extern Bool AddMapEntry(XkbDescPtr /* xkb */ , - KeyTypeInfo * /* type */ , - XkbKTMapEntryPtr /* new */ , - Bool /* clobber */ , - Bool /* report */ - ); - -extern Bool AddPreserve(XkbDescPtr /* xkb */ , - KeyTypeInfo * /* type */ , - PreserveInfo * /* new */ , - Bool /* clobber */ , - Bool /* report */ - ); - -extern Bool AddLevelName(KeyTypeInfo * /* type */ , - unsigned /* level */ , - Atom /* name */ , - Bool /* clobber */ , - Bool /* report */ - ); - #define MapEntryTxt(t,x,e) \ XkbVModMaskText((t)->dpy,(x),(e)->mods.real_mods,(e)->mods.vmods,XkbMessage) #define PreserveIndexTxt(t,x,p) \ @@ -531,7 +510,7 @@ NextMapEntry(KeyTypeInfo * type) return &type->entries[type->nEntries++]; } -Bool +static Bool AddPreserve(XkbDescPtr xkb, KeyTypeInfo * type, PreserveInfo * new, Bool clobber, Bool report) { @@ -603,7 +582,7 @@ AddPreserve(XkbDescPtr xkb, * @param clobber Overwrite existing entry. * @param report True if a warning is to be printed on. */ -Bool +static Bool AddMapEntry(XkbDescPtr xkb, KeyTypeInfo * type, XkbKTMapEntryPtr new, Bool clobber, Bool report) @@ -774,7 +753,7 @@ SetPreserve(KeyTypeInfo * type, /***====================================================================***/ -Bool +static Bool AddLevelName(KeyTypeInfo * type, unsigned level, Atom name, Bool clobber, Bool report) { diff --git a/listing.c b/listing.c index 6a2115a..663c652 100644 --- a/listing.c +++ b/listing.c @@ -163,7 +163,7 @@ AddMapOnly(char *map) return 1; } -int +static int AddListing(char *file, char *map) { if (nListed >= szListing) diff --git a/misc.c b/misc.c index f41c04c..b41a64c 100644 --- a/misc.c +++ b/misc.c @@ -226,7 +226,7 @@ UseNewField(unsigned field, return useNew; } -Bool +static Bool MergeNewField(unsigned field, CommonInfo * oldDefs, CommonInfo * newDefs, unsigned *pCollide) { diff --git a/misc.h b/misc.h index b6a5288..5c26d68 100644 --- a/misc.h +++ b/misc.h @@ -41,12 +41,6 @@ extern Bool UseNewField(unsigned /* field */ , unsigned * /* pCollide */ ); -extern Bool MergeNewField(unsigned /* field */ , - CommonInfo * /* oldDefs */ , - CommonInfo * /* newDefs */ , - unsigned * /* pCollide */ - ); - extern XPointer ClearCommonInfo(CommonInfo * /* cmn */ ); diff --git a/utils.c b/utils.c index fcf7a8c..31be8e7 100644 --- a/utils.c +++ b/utils.c @@ -58,9 +58,9 @@ uRecalloc(void *old, size_t nOld, size_t nNew, size_t itemSize) /*** PRINT FUNCTIONS ***/ /***====================================================================***/ -FILE *uDebugFile = NULL; +static FILE *uDebugFile = NULL; int uDebugIndentLevel = 0; -int uDebugIndentSize = 4; +static const int uDebugIndentSize = 4; Boolean uSetDebugFile(char *name) diff --git a/utils.h b/utils.h index 0a4484b..afa43e7 100644 --- a/utils.h +++ b/utils.h @@ -180,9 +180,8 @@ extern extern Boolean uSetDebugFile(char *name); - extern FILE *uDebugFile; extern int uDebugIndentLevel; - extern int uDebugIndentSize; + #define uDebugIndent(l) (uDebugIndentLevel+=(l)) #define uDebugOutdent(l) (uDebugIndentLevel-=(l)) #ifdef DEBUG diff --git a/vmod.c b/vmod.c index 97448c0..17aa7a7 100644 --- a/vmod.c +++ b/vmod.c @@ -165,7 +165,7 @@ HandleVModDef(VModDef * stmt, unsigned mergeMode, VModInfo * info) * @return True on success, False otherwise. If False is returned, val_rtrn is * undefined. */ -int +static int LookupVModIndex(XPointer priv, Atom elem, Atom field, unsigned type, ExprResult * val_rtrn) { diff --git a/vmod.h b/vmod.h index 75f9fb4..66683b5 100644 --- a/vmod.h +++ b/vmod.h @@ -53,13 +53,6 @@ extern Bool ApplyVModDefs(VModInfo * /* info */ , XkbDescPtr /* xkb */ ); -extern int LookupVModIndex(XPointer /* priv */ , - Atom /* elem */ , - Atom /* field */ , - unsigned /* type */ , - ExprResult * /* val_rtrn */ - ); - extern int LookupVModMask(XPointer /* priv */ , Atom /* elem */ , Atom /* field */ , diff --git a/xkbcomp.c b/xkbcomp.c index c7079ae..98e0d26 100644 --- a/xkbcomp.c +++ b/xkbcomp.c @@ -78,7 +78,7 @@ static const char *fileTypeExt[] = { }; static unsigned inputFormat, outputFormat; -char *rootDir; +static char *rootDir; static char *inputFile; static char *inputMap; static char *outputFile; @@ -93,7 +93,7 @@ static Bool xkblist = False; unsigned warningLevel = 5; unsigned verboseLevel = 0; unsigned dirsToStrip = 0; -unsigned optionalParts = 0; +static unsigned optionalParts = 0; static char *preErrorMsg = NULL; static char *postErrorMsg = NULL; static char *errorPrefix = NULL; diff --git a/xkbcomp.h b/xkbcomp.h index cd077ca..423a2cf 100644 --- a/xkbcomp.h +++ b/xkbcomp.h @@ -110,7 +110,6 @@ typedef struct _ParseCommon #define CreateKeyNames(x) ((x)->flags&AutoKeyNames) extern unsigned warningLevel; -extern unsigned optionalParts; typedef struct _IncludeStmt { @@ -377,14 +376,9 @@ extern Bool CompileSymbols(XkbFile * /* file */ , #define WantFullNames (1<<3) #define ListRecursive (1<<4) -extern char *rootDir; extern unsigned verboseLevel; extern unsigned dirsToStrip; -extern Bool AddListing(char * /* file */ , - char * /* map */ - ); - extern Bool AddMatchingFiles(char * /* head_in */ ); diff --git a/xkbpath.c b/xkbpath.c index b5405de..3c44d9c 100644 --- a/xkbpath.c +++ b/xkbpath.c @@ -175,7 +175,7 @@ XkbAddDefaultDirectoriesToPath(void) /** * Remove all entries from the global includePath. */ -void +static void XkbClearIncludePath(void) { if (szPath > 0) diff --git a/xkbpath.h b/xkbpath.h index 66c3ab7..65e9dee 100644 --- a/xkbpath.h +++ b/xkbpath.h @@ -29,8 +29,6 @@ extern Bool XkbInitIncludePath(void); -extern void XkbClearIncludePath(void); - extern void XkbAddDefaultDirectoriesToPath(void); extern Bool XkbAddDirectoryToPath(const char * /* dir */ -- cgit v1.2.3