Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: add missing uses of mod_export



I wrote:
> This adds mod_export to a number of functions/variables that are
> referenced from modules.

In checking for missing mod_exports, I also then trivially had a list of
superfluous ones. In contrast to the missing definitions, these don't
cause build failures but are non-ideal. The vast majority are functions
that likely are logically intended to be usable from modules just we
don't have any current users - I don't intend to touch these. But for a
good few, the mod_export is likely there as a side-effect of using copy
and paste. The following patch changes just those where I think this is
very likely to be the case. It's easy to restore if a module requires
access in a future change.

Oliver

diff --git a/Src/Zle/complete.c b/Src/Zle/complete.c
index 342611f1f..3e1c8b8d2 100644
--- a/Src/Zle/complete.c
+++ b/Src/Zle/complete.c
@@ -183,7 +183,7 @@ cpcmatcher(Cmatcher m)
  */
 
 /**/
-mod_export Cpattern
+static Cpattern
 cp_cpattern_element(Cpattern o)
 {
     Cpattern n = zalloc(sizeof(struct cpattern));
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 7dbc5676a..46de4466f 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -1961,7 +1961,7 @@ asklist(void)
 }
 
 /**/
-mod_export int
+static int
 printlist(int over, CLPrintFunc printm, int showall)
 {
     Cmgroup g;
diff --git a/Src/Zle/zle_keymap.c b/Src/Zle/zle_keymap.c
index cda24847d..95a60bcc2 100644
--- a/Src/Zle/zle_keymap.c
+++ b/Src/Zle/zle_keymap.c
@@ -1500,7 +1500,7 @@ default_bindings(void)
  */
 
 /**/
-mod_export ZLE_INT_T
+static ZLE_INT_T
 getrestchar_keybuf(void)
 {
     char c;
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 1afb1bf58..ab0b51374 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -126,8 +126,7 @@ mod_export Thingy lbindk, bindk;
 /**/
 int insmode;
 
-/**/
-mod_export int eofchar;
+static int eofchar;
 
 static int eofsent;
 /*
@@ -2048,7 +2047,7 @@ resetprompt(UNUSED(char **args))
 /* same bug called from outside zle */
 
 /**/
-mod_export void
+static void
 zle_resetprompt(void)
 {
     reexpandprompt();
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index e17a08d53..60982d92e 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -1539,7 +1539,7 @@ addsuffix(int tp, int flags, ZLE_STRING_T chars, int lenstr, int lensuf)
 /* Same as addsuffix, but from metafied string */
 
 /**/
-mod_export void
+static void
 addsuffixstring(int tp, int flags, char *chars, int lensuf)
 {
     int slen, alloclen;
diff --git a/Src/exec.c b/Src/exec.c
index d39b6f3ac..efc96d861 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4828,7 +4828,7 @@ getoutput(char *cmd, int qt)
  */
 
 /**/
-mod_export LinkList
+static LinkList
 readoutput(int in, int qt, int *readerror)
 {
     LinkList ret;
diff --git a/Src/hist.c b/Src/hist.c
index 4e4a20e31..8334b1ae5 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -2417,7 +2417,7 @@ convamps(char *out, char *in, int inlen)
 }
 
 /**/
-mod_export void
+static void
 checkcurline(Histent he)
 {
     if (he->histnum == curhist && (histactive & HA_ACTIVE)) {
diff --git a/Src/init.c b/Src/init.c
index 76de0b449..dfef860f7 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -84,7 +84,9 @@ mod_export int tclen[TC_COUNT];
 /**/
 int tclines, tccolumns;
 /**/
-mod_export int hasam, hasbw, hasxn, hasye;
+mod_export int hasam;
+/**/
+int hasxn;
 
 /* Value of the Co (max_colors) entry: may not be set */
 
@@ -97,7 +99,7 @@ mod_export int tccolours;
 mod_export sigset_t sigchld_mask;
 
 /**/
-mod_export struct hookdef zshhooks[] = {
+struct hookdef zshhooks[] = {
     HOOKDEF("exit", NULL, HOOKF_ALL),
     HOOKDEF("before_trap", NULL, HOOKF_ALL),
     HOOKDEF("after_trap", NULL, HOOKF_ALL),
@@ -815,9 +817,7 @@ init_term(void)
 
 	/* check whether terminal has automargin (wraparound) capability */
 	hasam = tgetflag("am");
-	hasbw = tgetflag("bw");
 	hasxn = tgetflag("xn"); /* also check for newline wraparound glitch */
-	hasye = tgetflag("YE"); /* print in last column does carriage return */
 
 	tclines = tgetnum("li");
 	tccolumns = tgetnum("co");
@@ -870,6 +870,8 @@ init_term(void)
 	rprompt_indent = 1; /* If you change this, update rprompt_indent_unsetfn() */
 	/* The following is an attempt at a heuristic,
 	 * but it fails in some cases */
+	/* int hasbw = tgetflag("bw"); */
+	/* int hasye = tgetflag("YE"); */ /* print in last column does carriage return */
 	/* rprompt_indent = ((hasam && !hasbw) || hasye || !tccan(TCLEFT)); */
 
 	/* if there's no termcap entry for italics, use CSI 3 m */
diff --git a/Src/jobs.c b/Src/jobs.c
index 66a7ec123..31938bedd 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -55,7 +55,7 @@
    when we started without being process group leader */
 
 /**/
-mod_export pid_t origpgrp;
+pid_t origpgrp;
 
 /* the process group of the shell */
 
@@ -98,12 +98,10 @@ mod_export int jobtabsize;
 mod_export int maxjob;
 
 /* If we have entered a subshell, the original shell's job table. */
-/**/
-mod_export struct job *oldjobtab;
+static struct job *oldjobtab;
 
 /* The size of that. */
-/**/
-mod_export int oldmaxjob;
+static int oldmaxjob;
 
 /* shell timings */
  
@@ -1833,7 +1831,7 @@ clearjobtab(int monitor)
 /* In a subshell, decide we want our own job table after all. */
 
 /**/
-mod_export void
+void
 clearoldjobtab(void)
 {
     if (oldjobtab)
diff --git a/Src/module.c b/Src/module.c
index af0251f4e..19d7d9d42 100644
--- a/Src/module.c
+++ b/Src/module.c
@@ -1337,7 +1337,7 @@ addmathfunc(MathFunc f)
 /* Delete a single math function */
 
 /**/
-mod_export int
+int
 deletemathfunc(MathFunc f)
 {
     MathFunc p, q;
diff --git a/Src/params.c b/Src/params.c
index 7b515515e..e873043df 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -56,7 +56,6 @@ mod_export int locallevel;
 /* Variables holding values of special parameters */
  
 /**/
-mod_export
 char **pparams,		/* $argv        */
      **cdpath,		/* $cdpath      */
      **fpath,		/* $fpath       */
@@ -70,13 +69,11 @@ char **path,		/* $path        */
      **fignore;		/* $fignore     */
  
 /**/
-mod_export
 char *argzero,		/* $0           */
-     *posixzero,	/* $0           */
-     *home,		/* $HOME        */
+     *ifs,		/* $IFS         */
      *nullcmd,		/* $NULLCMD     */
      *oldpwd,		/* $OLDPWD      */
-     *zoptarg,		/* $OPTARG      */
+     *posixzero,	/* $0           */
      *prompt,		/* $PROMPT      */
      *prompt2,		/* $PROMPT2     */
      *prompt3,		/* $PROMPT3     */
@@ -85,14 +82,15 @@ char *argzero,		/* $0           */
      *rprompt,		/* $RPROMPT     */
      *rprompt2,		/* $RPROMPT2    */
      *sprompt,		/* $SPROMPT     */
-     *wordchars;	/* $WORDCHARS   */
+     *wordchars,	/* $WORDCHARS   */
+     *zoptarg,		/* $OPTARG      */
+     *zsh_terminfo,     /* $TERMINFO    */
+     *zsh_terminfodirs; /* $TERMINFO_DIRS */
 /**/
 mod_export
-char *ifs,		/* $IFS         */
+char *home,		/* $HOME        */
      *postedit,		/* $POSTEDIT    */
      *term,		/* $TERM        */
-     *zsh_terminfo,     /* $TERMINFO    */
-     *zsh_terminfodirs, /* $TERMINFO_DIRS */
      *ttystrname,	/* $TTY         */
      *pwd;		/* $PWD         */
 
@@ -966,7 +964,7 @@ createparamtable(void)
 /* assign various functions used for non-special parameters */
 
 /**/
-mod_export void
+static void
 assigngetset(Param pm)
 {
     switch (PM_TYPE(pm->node.flags)) {
@@ -2660,7 +2658,7 @@ setstrvalue(Value v, char *val)
 }
 
 /**/
-mod_export void
+static void
 assignstrvalue(Value v, char *val, int flags)
 {
     if (unset(EXECOPT))
@@ -3623,7 +3621,7 @@ sethparam(char *s, char **val)
  */
 
 /**/
-mod_export Param
+static Param
 assignnparam(char *s, mnumber val, int flags)
 {
     struct value vbuf;
@@ -4260,7 +4258,7 @@ arrvarsetfn(Param pm, char **x)
 }
 
 /**/
-mod_export char *
+char *
 colonarrgetfn(Param pm)
 {
     char ***dptr = (char ***)pm->u.data;
@@ -4268,7 +4266,7 @@ colonarrgetfn(Param pm)
 }
 
 /**/
-mod_export void
+void
 colonarrsetfn(Param pm, char *x)
 {
     char ***dptr = (char ***)pm->u.data;
@@ -6444,7 +6442,7 @@ setscope(Param pm)
 }
 
 /**/
-mod_export Param
+static Param
 upscope(Param pm, int reflevel)
 {
     Param up = pm->old;
@@ -6460,7 +6458,7 @@ upscope(Param pm, int reflevel)
 }
 
 /**/
-mod_export int
+static int
 valid_refname(char *val)
 {
     char *t = itype_end(val, INAMESPC, 0);
diff --git a/Src/signals.c b/Src/signals.c
index de42f302d..2257f862f 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -87,9 +87,9 @@ mod_export volatile int queue_in;
 /* Variables used by trap queueing */
 
 /**/
-mod_export volatile int trap_queueing_enabled, trap_queue_front, trap_queue_rear;
+static volatile int trap_queueing_enabled, trap_queue_front, trap_queue_rear;
 /**/
-mod_export int trap_queue[MAX_QUEUE_SIZE];
+static int trap_queue[MAX_QUEUE_SIZE];
 
 /* Install signal handler for given signal.           *
  * If possible, we want to make sure that interrupted *




Messages sorted by: Reverse Date, Date, Thread, Author