diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-12-16 18:56:36 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-12-16 18:56:36 -0500 |
commit | f404167dda29a59d2be2882328aeb074b9899669 (patch) | |
tree | 6ee643255b5b9a9b7680bef1ec61f74f3d9da77f /lib | |
parent | 4727c67dc20f0c15cc8502b9bc3ee9f73d7e2c3a (diff) | |
download | e2fsprogs-f404167dda29a59d2be2882328aeb074b9899669.tar.gz |
Clean up sparse warnings
Mostly by adding static and removing excess extern qualifiers. Also
convert a few remaining non-ANSI function declarations to ANSI.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/et/com_err.c | 5 | ||||
-rw-r--r-- | lib/et/error_message.c | 3 | ||||
-rw-r--r-- | lib/et/error_table.h | 2 | ||||
-rw-r--r-- | lib/et/et_name.c | 3 | ||||
-rw-r--r-- | lib/ext2fs/Makefile.in | 6 | ||||
-rw-r--r-- | lib/ext2fs/bmap.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/dblist.c | 3 | ||||
-rw-r--r-- | lib/ext2fs/dir_iterate.c | 20 | ||||
-rw-r--r-- | lib/ext2fs/extent.c | 6 | ||||
-rw-r--r-- | lib/ext2fs/fileio.c | 3 | ||||
-rw-r--r-- | lib/ext2fs/mmp.c | 2 | ||||
-rw-r--r-- | lib/ext2fs/punch.c | 8 | ||||
-rw-r--r-- | lib/ss/error.c | 8 | ||||
-rw-r--r-- | lib/ss/execute_cmd.c | 20 | ||||
-rw-r--r-- | lib/ss/help.c | 18 | ||||
-rw-r--r-- | lib/ss/invocation.c | 12 | ||||
-rw-r--r-- | lib/ss/pager.c | 3 | ||||
-rw-r--r-- | lib/ss/parse.c | 5 | ||||
-rw-r--r-- | lib/ss/request_tbl.c | 11 | ||||
-rw-r--r-- | lib/ss/ss_internal.h | 1 |
20 files changed, 53 insertions, 88 deletions
diff --git a/lib/et/com_err.c b/lib/et/com_err.c index 4ea52def..d38998a2 100644 --- a/lib/et/com_err.c +++ b/lib/et/com_err.c @@ -85,8 +85,7 @@ void com_err (const char *whoami, va_end(pvar); } -errf set_com_err_hook (new_proc) - errf new_proc; +errf set_com_err_hook(errf new_proc) { errf x = com_err_hook; @@ -98,7 +97,7 @@ errf set_com_err_hook (new_proc) return x; } -errf reset_com_err_hook () { +errf reset_com_err_hook(void) { errf x = com_err_hook; com_err_hook = default_com_err_proc; return x; diff --git a/lib/et/error_message.c b/lib/et/error_message.c index 92509e63..5d8d2422 100644 --- a/lib/et/error_message.c +++ b/lib/et/error_message.c @@ -105,8 +105,7 @@ typedef char *(*gettextf) (const char *); static gettextf com_err_gettext = NULL; -gettextf set_com_err_gettext (new_proc) - gettextf new_proc; +gettextf set_com_err_gettext(gettextf new_proc) { gettextf x = com_err_gettext; diff --git a/lib/et/error_table.h b/lib/et/error_table.h index 4f109911..24e4762a 100644 --- a/lib/et/error_table.h +++ b/lib/et/error_table.h @@ -18,7 +18,7 @@ struct et_list { struct et_list *next; const struct error_table *table; }; -extern struct et_list * _et_list; +extern struct et_list *_et_list, *_et_dynamic_list; #define ERRCODE_RANGE 8 /* # of bits to shift table number */ #define BITS_PER_CHAR 6 /* # bits to shift per character in name */ diff --git a/lib/et/et_name.c b/lib/et/et_name.c index 6b59eddb..d9a3e874 100644 --- a/lib/et/et_name.c +++ b/lib/et/et_name.c @@ -21,8 +21,7 @@ static const char char_set[] = static char buf[6]; -const char * error_table_name(num) - errcode_t num; +const char * error_table_name(errcode_t num) { int ch; int i; diff --git a/lib/ext2fs/Makefile.in b/lib/ext2fs/Makefile.in index abe21247..87678c6a 100644 --- a/lib/ext2fs/Makefile.in +++ b/lib/ext2fs/Makefile.in @@ -306,7 +306,7 @@ extent_cmds.c extent_cmds.h: $(top_srcdir)/debugfs/extent_cmds.ct DEBUG_OBJS= debug_cmds.o debugfs.o util.o ncheck.o icheck.o ls.o \ lsdel.o dump.o set_fields.o logdump.o htree.o unused.o \ - e2freefrag.o filefrag.o extent_inode.o extent_cmds.o + e2freefrag.o filefrag.o extent_inode.o extent_cmds.o zap.o debugfs.o: $(top_srcdir)/debugfs/debugfs.c $(E) " CC $<" @@ -356,6 +356,10 @@ unused.o: $(top_srcdir)/debugfs/unused.c $(E) " CC $<" $(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@ +zap.o: $(top_srcdir)/debugfs/zap.c + $(E) " CC $<" + $(Q) $(CC) $(ALL_CFLAGS) -c $< -o $@ + e2freefrag.o: $(top_srcdir)/misc/e2freefrag.c $(E) " CC $<" $(Q) $(CC) $(ALL_CFLAGS) -DDEBUGFS -I$(top_srcdir)/debugfs -c $< -o $@ diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c index 3a18d760..b944c273 100644 --- a/lib/ext2fs/bmap.c +++ b/lib/ext2fs/bmap.c @@ -18,7 +18,7 @@ #include <errno.h> #include "ext2_fs.h" -#include "ext2fs.h" +#include "ext2fsP.h" #if defined(__GNUC__) && !defined(NO_INLINE_FUNCS) #define _BMAP_INLINE_ __inline__ diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c index 4cb7ca18..3f6ea50d 100644 --- a/lib/ext2fs/dblist.c +++ b/lib/ext2fs/dblist.c @@ -393,10 +393,11 @@ int ext2fs_dblist_count(ext2_dblist dblist) errcode_t ext2fs_dblist_get_last(ext2_dblist dblist, struct ext2_db_entry **entry) { - EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); static struct ext2_db_entry ret_entry; struct ext2_db_entry2 *last; + EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST); + if (dblist->count == 0) return EXT2_ET_DBLIST_EMPTY; diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c index 5125d199..589af692 100644 --- a/lib/ext2fs/dir_iterate.c +++ b/lib/ext2fs/dir_iterate.c @@ -151,16 +151,16 @@ static int xlate_func(ext2_ino_t dir EXT2FS_ATTR((unused)), return (*xl->func)(dirent, offset, blocksize, buf, xl->real_private); } -extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, - ext2_ino_t dir, - int flags, - char *block_buf, - int (*func)(struct ext2_dir_entry *dirent, - int offset, - int blocksize, - char *buf, - void *priv_data), - void *priv_data) +errcode_t ext2fs_dir_iterate(ext2_filsys fs, + ext2_ino_t dir, + int flags, + char *block_buf, + int (*func)(struct ext2_dir_entry *dirent, + int offset, + int blocksize, + char *buf, + void *priv_data), + void *priv_data) { struct xlate xl; diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c index f3ee49d6..5cdc2e49 100644 --- a/lib/ext2fs/extent.c +++ b/lib/ext2fs/extent.c @@ -160,7 +160,7 @@ errcode_t ext2fs_extent_header_verify(void *ptr, int size) /* * Begin functions to handle an inode's extent information */ -extern void ext2fs_extent_free(ext2_extent_handle_t handle) +void ext2fs_extent_free(ext2_extent_handle_t handle) { int i; @@ -177,13 +177,13 @@ extern void ext2fs_extent_free(ext2_extent_handle_t handle) ext2fs_free_mem(&handle); } -extern errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, +errcode_t ext2fs_extent_open(ext2_filsys fs, ext2_ino_t ino, ext2_extent_handle_t *ret_handle) { return ext2fs_extent_open2(fs, ino, NULL, ret_handle); } -extern errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino, +errcode_t ext2fs_extent_open2(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, ext2_extent_handle_t *ret_handle) { diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c index 77328042..5a39c321 100644 --- a/lib/ext2fs/fileio.c +++ b/lib/ext2fs/fileio.c @@ -395,7 +395,8 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file) } /* Zero the parts of the last block that are past EOF. */ -errcode_t ext2fs_file_zero_past_offset(ext2_file_t file, ext2_off64_t offset) +static errcode_t ext2fs_file_zero_past_offset(ext2_file_t file, + ext2_off64_t offset) { ext2_filsys fs = file->fs; char *b = NULL; diff --git a/lib/ext2fs/mmp.c b/lib/ext2fs/mmp.c index fb266d1d..e4c7dccd 100644 --- a/lib/ext2fs/mmp.c +++ b/lib/ext2fs/mmp.c @@ -127,7 +127,7 @@ errcode_t ext2fs_mmp_write(ext2_filsys fs, blk64_t mmp_blk, void *buf) #define rand() random() #endif -unsigned ext2fs_mmp_new_seq() +unsigned ext2fs_mmp_new_seq(void) { unsigned new_seq; struct timeval tv; diff --git a/lib/ext2fs/punch.c b/lib/ext2fs/punch.c index 9fff7048..25d79532 100644 --- a/lib/ext2fs/punch.c +++ b/lib/ext2fs/punch.c @@ -410,10 +410,10 @@ errout: * Deallocate all logical blocks starting at start to end, inclusive. * If end is ~0, then this is effectively truncate. */ -extern errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino, - struct ext2_inode *inode, - char *block_buf, blk64_t start, - blk64_t end) +errcode_t ext2fs_punch(ext2_filsys fs, ext2_ino_t ino, + struct ext2_inode *inode, + char *block_buf, blk64_t start, + blk64_t end) { errcode_t retval; struct ext2_inode inode_buf; diff --git a/lib/ss/error.c b/lib/ss/error.c index 781ba82d..8d345a9f 100644 --- a/lib/ss/error.c +++ b/lib/ss/error.c @@ -20,8 +20,7 @@ #include <stdarg.h> -char * ss_name(sci_idx) - int sci_idx; +char *ss_name(int sci_idx) { register char *ret_val; register ss_data *infop; @@ -70,10 +69,7 @@ void ss_error (int sci_idx, long code, const char * fmt, ...) va_end(pvar); } -void ss_perror (sci_idx, code, msg) /* for compatibility */ - int sci_idx; - long code; - char const *msg; +void ss_perror(int sci_idx, long code, char const *msg) /* for compatibility */ { ss_error (sci_idx, code, "%s", msg); } diff --git a/lib/ss/execute_cmd.c b/lib/ss/execute_cmd.c index 53c10c9c..d443a468 100644 --- a/lib/ss/execute_cmd.c +++ b/lib/ss/execute_cmd.c @@ -82,11 +82,8 @@ static struct _ss_request_entry * get_request (tbl, idx) * Notes: */ -static int check_request_table (rqtbl, argc, argv, sci_idx) - register ss_request_table *rqtbl; - int argc; - char *argv[]; - int sci_idx; +static int check_request_table(register ss_request_table *rqtbl, int argc, + char *argv[], int sci_idx) { #ifdef __SABER__ struct _ss_request_entry *request; @@ -135,10 +132,7 @@ static int check_request_table (rqtbl, argc, argv, sci_idx) * Notes: */ -static int really_execute_command (sci_idx, argc, argv) - int sci_idx; - int argc; - char **argv[]; +static int really_execute_command(int sci_idx, int argc, char **argv[]) { register ss_request_table **rqtbl; register ss_data *info; @@ -168,9 +162,7 @@ static int really_execute_command (sci_idx, argc, argv) * Notes: */ -int ss_execute_command(sci_idx, argv) - int sci_idx; - register char *argv[]; +int ss_execute_command(int sci_idx, register char *argv[]) { register int i, argc; char **argp; @@ -202,9 +194,7 @@ int ss_execute_command(sci_idx, argv) * Notes: */ -int ss_execute_line (sci_idx, line_ptr) - int sci_idx; - char *line_ptr; +int ss_execute_line(int sci_idx, char *line_ptr) { char **argv; int argc, ret; diff --git a/lib/ss/help.c b/lib/ss/help.c index 5278c953..5204401b 100644 --- a/lib/ss/help.c +++ b/lib/ss/help.c @@ -36,11 +36,7 @@ extern int errno; #endif #include "ss_internal.h" -void ss_help (argc, argv, sci_idx, info_ptr) - int argc; - char const * const *argv; - int sci_idx; - pointer info_ptr; +void ss_help(int argc, char const * const *argv, int sci_idx, pointer info_ptr) { char *buffer; char const *request_name; @@ -117,7 +113,7 @@ void ss_help (argc, argv, sci_idx, info_ptr) ss_page_stdin(); default: (void) close(fd); /* what can we do if it fails? */ - while (wait(0) != child) { + while (wait(NULL) != child) { /* do nothing if wrong pid */ }; } @@ -129,10 +125,7 @@ void ss_help (argc, argv, sci_idx, info_ptr) #include <dirent.h> #endif -void ss_add_info_dir(sci_idx, info_dir, code_ptr) - int sci_idx; - char *info_dir; - int *code_ptr; +void ss_add_info_dir(int sci_idx, char *info_dir, int *code_ptr) { register ss_data *info; DIR *d; @@ -166,10 +159,7 @@ void ss_add_info_dir(sci_idx, info_dir, code_ptr) *code_ptr = 0; } -void ss_delete_info_dir(sci_idx, info_dir, code_ptr) - int sci_idx; - char *info_dir; - int *code_ptr; +void ss_delete_info_dir(int sci_idx, char *info_dir, int *code_ptr) { register char **i_d; register char **info_dirs; diff --git a/lib/ss/invocation.c b/lib/ss/invocation.c index 08b66f28..61c2e350 100644 --- a/lib/ss/invocation.c +++ b/lib/ss/invocation.c @@ -22,12 +22,9 @@ #endif #include <errno.h> -int ss_create_invocation(subsystem_name, version_string, info_ptr, - request_table_ptr, code_ptr) - const char *subsystem_name, *version_string; - void *info_ptr; - ss_request_table *request_table_ptr; - int *code_ptr; +int ss_create_invocation(const char *subsystem_name, const char *version_string, + void *info_ptr, ss_request_table *request_table_ptr, + int *code_ptr) { register int sci_idx; register ss_data *new_table; @@ -90,8 +87,7 @@ int ss_create_invocation(subsystem_name, version_string, info_ptr, } void -ss_delete_invocation(sci_idx) - int sci_idx; +ss_delete_invocation(int sci_idx) { register ss_data *t; int ignored_code; diff --git a/lib/ss/pager.c b/lib/ss/pager.c index 8b54dd1a..330249ec 100644 --- a/lib/ss/pager.c +++ b/lib/ss/pager.c @@ -42,7 +42,6 @@ extern int errno; #endif static char MORE[] = "more"; -extern char *_ss_pager_name; extern char *getenv PROTOTYPE((const char *)); char *ss_safe_getenv(const char *arg) @@ -131,7 +130,7 @@ static int write_all(int fd, char *buf, size_t count) return c; } -void ss_page_stdin() +void ss_page_stdin(void) { int i; sigset_t mask; diff --git a/lib/ss/parse.c b/lib/ss/parse.c index baded665..e2928e22 100644 --- a/lib/ss/parse.c +++ b/lib/ss/parse.c @@ -43,10 +43,7 @@ enum parse_mode { WHITESPACE, TOKEN, QUOTED_STRING }; #define NEW_ARGV(old,n) (char **)realloc((char *)old,\ (unsigned)(n+2)*sizeof(char*)) -char **ss_parse (sci_idx, line_ptr, argc_ptr) - int sci_idx; - register char *line_ptr; - int *argc_ptr; +char **ss_parse(int sci_idx, register char *line_ptr, int *argc_ptr) { register char **argv, *cp; register int argc; diff --git a/lib/ss/request_tbl.c b/lib/ss/request_tbl.c index efdabfa3..135cb28b 100644 --- a/lib/ss/request_tbl.c +++ b/lib/ss/request_tbl.c @@ -20,11 +20,7 @@ #define ssrt ss_request_table /* for some readable code... */ -void ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr) - int sci_idx; - ssrt *rqtbl_ptr; - int position; /* 1 -> becomes second... */ - int *code_ptr; +void ss_add_request_table(int sci_idx, ssrt *rqtbl_ptr, int position, int *code_ptr) { register ss_data *info; register int i, size; @@ -53,10 +49,7 @@ void ss_add_request_table(sci_idx, rqtbl_ptr, position, code_ptr) *code_ptr = 0; } -void ss_delete_request_table(sci_idx, rqtbl_ptr, code_ptr) - int sci_idx; - ssrt *rqtbl_ptr; - int *code_ptr; +void ss_delete_request_table(int sci_idx, ssrt *rqtbl_ptr, int *code_ptr) { register ss_data *info; register ssrt **rt1, **rt2; diff --git a/lib/ss/ss_internal.h b/lib/ss/ss_internal.h index 15d618ee..19a6be7a 100644 --- a/lib/ss/ss_internal.h +++ b/lib/ss/ss_internal.h @@ -94,6 +94,7 @@ char **ss_rl_completion(const char *text, int start, int end); extern ss_data **_ss_table; extern char *ss_et_msgs[]; +extern char *_ss_pager_name; #ifdef USE_SIGPROCMASK /* fake sigmask, sigblock, sigsetmask */ |