Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] add 'static' to file local variables
- X-seq: zsh-workers 37868
- From: "Jun T." <takimoto-j@xxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] add 'static' to file local variables
- Date: Wed, 3 Feb 2016 00:06:39 +0900
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
Based on warnings from 'clang -Wmissing-variable-declarations'.
In cond.c, add /**/ to tracingcond, which is global.
---
Src/Modules/curses.c | 2 +-
Src/Modules/param_private.c | 10 +++++-----
Src/Modules/tcp.c | 2 +-
Src/Modules/termcap.c | 2 +-
Src/Modules/zftp.c | 8 ++++----
Src/Zle/complist.c | 2 +-
Src/Zle/zle_misc.c | 2 +-
Src/Zle/zle_utils.c | 4 ++--
Src/cond.c | 3 ++-
Src/exec.c | 2 --
Src/glob.c | 2 +-
Src/jobs.c | 6 +++---
Src/params.c | 2 +-
Src/prompt.c | 2 +-
Src/utils.c | 4 ++--
15 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/Src/Modules/curses.c b/Src/Modules/curses.c
index b8a79ed..a04841a 100644
--- a/Src/Modules/curses.c
+++ b/Src/Modules/curses.c
@@ -202,7 +202,7 @@ static const struct zcurses_mouse_event zcurses_mouse_map[] = {
{ 0, 0, 0 }
};
-mmask_t zcurses_mouse_mask = ALL_MOUSE_EVENTS;
+static mmask_t zcurses_mouse_mask = ALL_MOUSE_EVENTS;
#endif
diff --git a/Src/Modules/param_private.c b/Src/Modules/param_private.c
index 2f51cb0..86416c5 100644
--- a/Src/Modules/param_private.c
+++ b/Src/Modules/param_private.c
@@ -42,19 +42,19 @@ struct gsu_closure {
void *g;
};
-const struct gsu_scalar scalar_private_gsu =
+static const struct gsu_scalar scalar_private_gsu =
{ pps_getfn, pps_setfn, pps_unsetfn };
-const struct gsu_integer integer_private_gsu =
+static const struct gsu_integer integer_private_gsu =
{ ppi_getfn, ppi_setfn, ppi_unsetfn };
-const struct gsu_float float_private_gsu =
+static const struct gsu_float float_private_gsu =
{ ppf_getfn, ppf_setfn, ppf_unsetfn };
-const struct gsu_array array_private_gsu =
+static const struct gsu_array array_private_gsu =
{ ppa_getfn, ppa_setfn, ppa_unsetfn };
-const struct gsu_hash hash_private_gsu =
+static const struct gsu_hash hash_private_gsu =
{ pph_getfn, pph_setfn, pph_unsetfn };
/*
diff --git a/Src/Modules/tcp.c b/Src/Modules/tcp.c
index 5af6883..dec1214 100644
--- a/Src/Modules/tcp.c
+++ b/Src/Modules/tcp.c
@@ -208,7 +208,7 @@ freehostent(UNUSED(struct hostent *ptr))
/**/
#endif /* !HAVE_GETIPNODEBYNAME */
-LinkList ztcp_sessions;
+static LinkList ztcp_sessions;
/* "allocate" a tcp_session */
static Tcp_session
diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c
index 29c2836..60a6e13 100644
--- a/Src/Modules/termcap.c
+++ b/Src/Modules/termcap.c
@@ -295,7 +295,7 @@ scantermcap(UNUSED(HashTable ht), ScanFunc func, int flags)
}
}
-struct paramdef partab[] = {
+static struct paramdef partab[] = {
SPECIALPMDEF("termcap", PM_READONLY, NULL, gettermcap, scantermcap)
};
diff --git a/Src/Modules/zftp.c b/Src/Modules/zftp.c
index b4081df..deed35e 100644
--- a/Src/Modules/zftp.c
+++ b/Src/Modules/zftp.c
@@ -344,10 +344,10 @@ static int zfsesscnt;
*/
/* flags for alarm set, alarm gone off */
-int zfalarmed, zfdrrrring;
+static int zfalarmed, zfdrrrring;
/* remember old alarm status */
-time_t oaltime;
-unsigned int oalremain;
+static time_t oaltime;
+static unsigned int oalremain;
/*
* Where to jump to when the alarm goes off. This is much
@@ -357,7 +357,7 @@ unsigned int oalremain;
*
* gcc -O gives apparently spurious `may be clobbered by longjmp' warnings.
*/
-jmp_buf zfalrmbuf;
+static jmp_buf zfalrmbuf;
/* The signal handler itself */
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 0ccb885..06a07a4 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -113,7 +113,7 @@ static Cmgroup *mgtab, *mgtabp;
* Allow us to keep track of pointer arithmetic for mgtab; could
* just as well have been for mtab but wasn't.
*/
-int mgtabsize;
+static int mgtabsize;
#endif
/*
diff --git a/Src/Zle/zle_misc.c b/Src/Zle/zle_misc.c
index 0483f75..25f65b3 100644
--- a/Src/Zle/zle_misc.c
+++ b/Src/Zle/zle_misc.c
@@ -1497,7 +1497,7 @@ struct suffixset {
};
/* The list of suffix structures */
-struct suffixset *suffixlist;
+static struct suffixset *suffixlist;
/* Shell function to call to remove the suffix. */
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index a2c8810..68794c6 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -587,7 +587,7 @@ struct zle_position {
};
/* LIFO stack of positions */
-struct zle_position *zle_positions;
+static struct zle_position *zle_positions;
/*
* Save positions including cursor, end-of-line and
@@ -1412,7 +1412,7 @@ zlong undo_changeno;
/* If positive, don't undo beyond this point */
-zlong undo_limitno;
+static zlong undo_limitno;
/**/
void
diff --git a/Src/cond.c b/Src/cond.c
index c5ab65e..0381fe9 100644
--- a/Src/cond.c
+++ b/Src/cond.c
@@ -30,7 +30,8 @@
#include "zsh.mdh"
#include "cond.pro"
-int tracingcond;
+/**/
+int tracingcond; /* updated by execcond() in exec.c */
static char *condstr[COND_MOD] = {
"!", "&&", "||", "==", "!=", "<", ">", "-nt", "-ot", "-ef", "-eq",
diff --git a/Src/exec.c b/Src/exec.c
index 352615c..b60fc90 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -4518,8 +4518,6 @@ spawnpipes(LinkList l, int nullexec)
}
}
-extern int tracingcond;
-
/* evaluate a [[ ... ]] */
/**/
diff --git a/Src/glob.c b/Src/glob.c
index 69de155..2051016 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -306,7 +306,7 @@ statfullpath(const char *s, struct stat *st, int l)
/* This may be set by qualifier functions to an array of strings to insert
* into the list instead of the original string. */
-char **inserts;
+static char **inserts;
/* add a match to the list */
diff --git a/Src/jobs.c b/Src/jobs.c
index b47ba8c..2a9dbe7 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -1970,9 +1970,9 @@ struct bgstatus {
};
typedef struct bgstatus *Bgstatus;
/* The list of those entries */
-LinkList bgstatus_list;
+static LinkList bgstatus_list;
/* Count of entries. Reaches value of _SC_CHILD_MAX and stops. */
-long bgstatus_count;
+static long bgstatus_count;
/*
* Remove and free a bgstatus entry.
@@ -2372,7 +2372,7 @@ bin_fg(char *name, char **argv, Options ops, int func)
return retval;
}
-const struct {
+static const struct {
const char *name;
int num;
} alt_sigs[] = {
diff --git a/Src/params.c b/Src/params.c
index a1f0292..76ed61c 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -416,7 +416,7 @@ IPDEF10("pipestatus", pipestatus_gsu),
* and $@, this is not readonly. This parameter is not directly
* visible in user space.
*/
-initparam argvparam_pm = IPDEF9F("", &pparams, NULL, \
+static initparam argvparam_pm = IPDEF9F("", &pparams, NULL, \
PM_ARRAY|PM_SPECIAL|PM_DONTIMPORT);
#undef BR
diff --git a/Src/prompt.c b/Src/prompt.c
index be067ee..831c4f9 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1831,7 +1831,7 @@ struct colour_sequences {
char *end; /* Escape sequence terminator */
char *def; /* Code to reset default colour */
};
-struct colour_sequences fg_bg_sequences[2];
+static struct colour_sequences fg_bg_sequences[2];
/*
* We need a buffer for colour sequence composition. It may
diff --git a/Src/utils.c b/Src/utils.c
index 053731c..de4af5a 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -56,12 +56,12 @@ typedef struct widechar_array *Widechar_array;
* The wordchars variable turned into a wide character array.
* This is much more convenient for testing.
*/
-struct widechar_array wordchars_wide;
+static struct widechar_array wordchars_wide;
/*
* The same for the separators (IFS) array.
*/
-struct widechar_array ifs_wide;
+static struct widechar_array ifs_wide;
/* Function to set one of the above from the multibyte array */
--
1.9.5 (Apple Git-50.3)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author