[PATCH] shell: correctly prototype all functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes all warnings with -Wall -Wextra on Clang trunk

Also fix a missing const

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@xxxxxxxxxxxxxxxxxx>
---
Please keep me in CC, as I'm not subscribed

 src/eval.c       |  5 +++--
 src/eval.h       |  2 +-
 src/exec.c       | 10 ++--------
 src/jobs.c       |  4 +---
 src/mksignames.c |  5 ++---
 src/nodes.c.pat  | 15 +++++----------
 src/options.c    |  3 +--
 src/redir.c      | 13 ++++---------
 8 files changed, 19 insertions(+), 38 deletions(-)

diff --git a/src/eval.c b/src/eval.c
index 3337f71..ea4804d 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -167,13 +167,14 @@ static int evalcmd(int argc, char **argv, int flags)
  */
 
 int
-evalstring(char *s, int flags)
+evalstring(const char *sc, int flags)
 {
 	union node *n;
+	char *s;
 	struct stackmark smark;
 	int status;
 
-	s = sstrdup(s);
+	s = sstrdup(sc);
 	setinputstring(s);
 	setstackmark(&smark);
 
diff --git a/src/eval.h b/src/eval.h
index 63e7d86..fb35a41 100644
--- a/src/eval.h
+++ b/src/eval.h
@@ -51,7 +51,7 @@ struct backcmd {		/* result of evalbackcmd */
 #define EV_EXIT 01		/* exit after evaluating tree */
 #define EV_TESTED 02		/* exit status is checked; ignore -e flag */
 
-int evalstring(char *, int);
+int evalstring(const char *, int);
 union node;	/* BLETCH for ansi C */
 int evaltree(union node *, int);
 void evalbackcmd(union node *, struct backcmd *);
diff --git a/src/exec.c b/src/exec.c
index 87354d4..535a8a1 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -770,11 +770,7 @@ typecmd(int argc, char **argv)
 }
 
 STATIC int
-describe_command(out, command, path, verbose)
-	struct output *out;
-	char *command;
-	const char *path;
-	int verbose;
+describe_command(struct output *out, char *command, const char *path, int verbose)
 {
 	struct cmdentry entry;
 	struct tblentry *cmdp;
@@ -876,9 +872,7 @@ out:
 }
 
 int
-commandcmd(argc, argv)
-	int argc;
-	char **argv;
+commandcmd(int argc, char **argv)
 {
 	char *cmd;
 	int c;
diff --git a/src/jobs.c b/src/jobs.c
index f3b9ffc..6176d0c 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -244,9 +244,7 @@ close:
 
 
 int
-killcmd(argc, argv)
-	int argc;
-	char **argv;
+killcmd(int argc, char **argv)
 {
 	extern char *signal_names[];
 	int signo = -1;
diff --git a/src/mksignames.c b/src/mksignames.c
index a832eab..8fe2171 100644
--- a/src/mksignames.c
+++ b/src/mksignames.c
@@ -55,7 +55,7 @@ char *progname;
 #endif
 
 void
-initialize_signames ()
+initialize_signames (void)
 {
   register int i;
 #if defined (SIGRTMAX) || defined (SIGRTMIN)
@@ -361,8 +361,7 @@ initialize_signames ()
 }
 
 void
-write_signames (stream)
-     FILE *stream;
+write_signames (FILE *stream)
 {
   register int i;
 
diff --git a/src/nodes.c.pat b/src/nodes.c.pat
index 9125bc7..463f7f5 100644
--- a/src/nodes.c.pat
+++ b/src/nodes.c.pat
@@ -88,8 +88,7 @@ copyfunc(union node *n)
 
 
 STATIC void
-calcsize(n)
-	union node *n;
+calcsize(union node *n)
 {
 	%CALCSIZE
 }
@@ -97,8 +96,7 @@ calcsize(n)
 
 
 STATIC void
-sizenodelist(lp)
-	struct nodelist *lp;
+sizenodelist(struct nodelist *lp)
 {
 	while (lp) {
 		funcblocksize += SHELL_ALIGN(sizeof(struct nodelist));
@@ -110,8 +108,7 @@ sizenodelist(lp)
 
 
 STATIC union node *
-copynode(n)
-	union node *n;
+copynode(union node *n)
 {
 	union node *new;
 
@@ -121,8 +118,7 @@ copynode(n)
 
 
 STATIC struct nodelist *
-copynodelist(lp)
-	struct nodelist *lp;
+copynodelist(struct nodelist *lp)
 {
 	struct nodelist *start;
 	struct nodelist **lpp;
@@ -143,8 +139,7 @@ copynodelist(lp)
 
 
 STATIC char *
-nodesavestr(s)
-	char   *s;
+nodesavestr(char *s)
 {
 	char   *rtn = funcstring;
 
diff --git a/src/options.c b/src/options.c
index a46c23b..db64111 100644
--- a/src/options.c
+++ b/src/options.c
@@ -390,8 +390,7 @@ setcmd(int argc, char **argv)
 
 
 void
-getoptsreset(value)
-	const char *value;
+getoptsreset(const char *value)
 {
 	shellparam.optind = number(value) ?: 1;
 	shellparam.optoff = -1;
diff --git a/src/redir.c b/src/redir.c
index 93abba3..1bbb214 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -282,17 +282,12 @@ ecreate:
 
 
 STATIC void
+dupredirect(union node *redir, int f
 #ifdef notyet
-dupredirect(redir, f, memory)
-#else
-dupredirect(redir, f)
+    , char memory[10]
 #endif
-	union node *redir;
-	int f;
-#ifdef notyet
-	char memory[10];
-#endif
-	{
+)
+{
 	int fd = redir->nfile.fd;
 	int err = 0;
 
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux