[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-tar] paxutils lint removal with prototypes, const, etc.
From: |
Paul Eggert |
Subject: |
[Bug-tar] paxutils lint removal with prototypes, const, etc. |
Date: |
Wed, 16 Jun 2010 12:46:23 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 |
I'm installing the following into paxutils to fix some
lint that I found with gcc's -Wall and similar options.
(This patch also omits some trailing white space, but
I left that out of the diff below.)
Remove some lint, found by gcc -W etc.
* lib/rtapelib.c (do_command, rmt_write__): Use function
prototypes instead of old-style decls.
* paxlib/error.c (write_fatal): Remove unused and undeclared
function.
* paxlib/paxlib.h (stat_fatal, pax_exit): Add noreturn attribute.
(write_error_details): New decl.
* rmt/rmt.c (rmt_read, rmt_write, rmt_reply, rmt_error_message):
(rmt_error, xlat_kw, skip_ws, decode_open_flag, close_device):
(lseek_device, read_device, write_device, iocop_device, status_device):
Declare as static, since they're not exported.
Use function prototypes (void) instead of old-style decls ().
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index cb645db..3aee428 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -121,7 +121,7 @@ do_command (int handle, const char *buffer)
/* Save the current pipe handler and try to make the request. */
size_t length = strlen (buffer);
- RETSIGTYPE (*pipe_handler) () = signal (SIGPIPE, SIG_IGN);
+ RETSIGTYPE (*pipe_handler) (int) = signal (SIGPIPE, SIG_IGN);
ssize_t written = full_write (WRITE_SIDE (handle), buffer, length);
signal (SIGPIPE, pipe_handler);
@@ -596,7 +596,7 @@ size_t
rmt_write__ (int handle, char *buffer, size_t length)
{
char command_buffer[COMMAND_BUFFER_SIZE];
- RETSIGTYPE (*pipe_handler) ();
+ RETSIGTYPE (*pipe_handler) (int);
size_t written;
sprintf (command_buffer, "W%lu\n", (unsigned long) length);
diff --git a/paxlib/error.c b/paxlib/error.c
index b4edb68..56903a3 100644
--- a/paxlib/error.c
+++ b/paxlib/error.c
@@ -353,12 +353,6 @@ write_error_details (char const *name, size_t status,
size_t size)
}
void
-write_fatal (char const *name)
-{
- call_arg_fatal ("write", name);
-}
-
-void
chdir_fatal (char const *name)
{
call_arg_fatal ("chdir", name);
diff --git a/paxlib/paxlib.h b/paxlib/paxlib.h
index 2fa396a..4aaf2eb 100644
--- a/paxlib/paxlib.h
+++ b/paxlib/paxlib.h
@@ -88,7 +88,7 @@ void seek_error (char const *);
void seek_error_details (char const *, off_t);
void seek_warn (char const *);
void seek_warn_details (char const *, off_t);
-void stat_fatal (char const *);
+void stat_fatal (char const *) __attribute__ ((noreturn));
void stat_error (char const *);
void stat_warn (char const *);
void symlink_error (char const *, char const *);
@@ -98,8 +98,9 @@ void unlink_error (char const *);
void utime_error (char const *);
void waitpid_error (char const *);
void write_error (char const *);
+void write_error_details (char const *, size_t, size_t);
-void pax_exit (void);
+void pax_exit (void) __attribute__ ((noreturn));;
void fatal_exit (void) __attribute__ ((noreturn));
#define STRINGIFY_BIGINT(i, b) umaxtostr (i, b)
diff --git a/rmt/rmt.c b/rmt/rmt.c
index 098ff57..3fb7540 100644
--- a/rmt/rmt.c
+++ b/rmt/rmt.c
@@ -80,7 +80,7 @@ trimnl (char *str)
char *input_buf_ptr = NULL;
size_t input_buf_size = 0;
-char *
+static char *
rmt_read (void)
{
ssize_t rc = getline (&input_buf_ptr, &input_buf_size, stdin);
@@ -94,7 +94,7 @@ rmt_read (void)
return NULL;
}
-void
+static void
rmt_write (const char *fmt, ...)
{
va_list ap;
@@ -103,14 +103,14 @@ rmt_write (const char *fmt, ...)
VDEBUG (10, "S: ", fmt, ap);
}
-void
+static void
rmt_reply (uintmax_t code)
{
char buf[UINTMAX_STRSIZE_BOUND];
rmt_write ("A%s\n", umaxtostr (code, buf));
}
-void
+static void
rmt_error_message (int code, const char *msg)
{
DEBUG1 (10, "S: E%d\n", code);
@@ -119,7 +119,7 @@ rmt_error_message (int code, const char *msg)
fprintf (stdout, "E%d\n%s\n", code, msg);
}
-void
+static void
rmt_error (int code)
{
rmt_error_message (code, strerror (code));
@@ -152,7 +152,7 @@ struct rmt_kw
#define RMT_KW(s,v) { #s, sizeof (#s) - 1, v }
-int
+static int
xlat_kw (const char *s, const char *pfx,
struct rmt_kw const *kw, int *valp, const char **endp)
{
@@ -182,7 +182,7 @@ xlat_kw (const char *s, const char *pfx,
return 1;
}
-const char *
+static const char *
skip_ws (const char *s)
{
while (*s && c_isblank (*s))
@@ -222,7 +222,7 @@ static struct rmt_kw const open_flag_kw[] =
{ NULL }
};
-int
+static int
decode_open_flag (const char *mstr, int *pmode)
{
int mode = 0;
@@ -341,7 +341,7 @@ open_device (char *str)
A0\n on success, E0\n<msg>\n on error.
*/
static void
-close_device ()
+close_device (void)
{
if (close (device_fd) < 0)
rmt_error (errno);
@@ -385,7 +385,7 @@ static struct rmt_kw const seek_whence_kw[] =
{ NULL }
};
-void
+static void
lseek_device (const char *str)
{
char *p;
@@ -460,7 +460,7 @@ lseek_device (const char *str)
On error: E0\n<msg>\n
*/
-void
+static void
read_device (const char *str)
{
char *p;
@@ -511,7 +511,7 @@ read_device (const char *str)
On error: E0\n<msg>\n
*/
-void
+static void
write_device (const char *str)
{
char *p;
@@ -568,7 +568,7 @@ write_device (const char *str)
On error: E0\n<msg>\n
*/
-void
+static void
iocop_device (const char *str)
{
char *p;
@@ -637,7 +637,7 @@ iocop_device (const char *str)
On error: E0\n<msg>\n
*/
-void
+static void
status_device (const char *str)
{
if (*str)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug-tar] paxutils lint removal with prototypes, const, etc.,
Paul Eggert <=