All of lore.kernel.org
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: dash@vger.kernel.org
Subject: [PATCH] shell: correctly prototype all functions
Date: Fri, 6 May 2022 16:49:19 +0200	[thread overview]
Message-ID: <20220506144919.6rpwoq5edahq7s3z@tarta.nabijaczleweli.xyz> (raw)

[-- Attachment #1: Type: text/plain, Size: 4587 bytes --]

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

Also fix a missing const

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

                 reply	other threads:[~2022-05-06 14:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220506144919.6rpwoq5edahq7s3z@tarta.nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.