>From dc57dad0fd9ccc43e65491e7416652d1437dff30 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 4 Dec 2009 23:19:07 +0100 Subject: [PATCH 1/4] maint: enable cast_of_alloca_return_value check
* cfg.mk (local-checks-to-skip): Enable sc_cast_of_alloca_return_value. * .x-sc_cast_of_alloca_return_value: New file. --- .x-sc_cast_of_alloca_return_value | 1 + cfg.mk | 1 - 2 files changed, 1 insertions(+), 1 deletions(-) create mode 100644 .x-sc_cast_of_alloca_return_value diff --git a/.x-sc_cast_of_alloca_return_value b/.x-sc_cast_of_alloca_return_value new file mode 100644 index 0000000..748e1b0 --- /dev/null +++ b/.x-sc_cast_of_alloca_return_value @@ -0,0 +1 @@ +lib/regex.c diff --git a/cfg.mk b/cfg.mk index 7233197..92aee2f 100644 --- a/cfg.mk +++ b/cfg.mk @@ -22,7 +22,6 @@ gpg_key_ID = B9AB9A16 # Tests not to run as part of "make distcheck". local-checks-to-skip = \ - sc_cast_of_alloca_return_value \ sc_cast_of_argument_to_free \ sc_cast_of_x_alloc_return_value \ sc_error_message_uppercase \ -- 1.6.6.rc3.271.g3d40f >From acd6c7be4dab1cc5d4012f1074691999d4fd3083 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 4 Dec 2009 23:31:34 +0100 Subject: [PATCH 2/4] maint: enable cast_of_x_alloc_return_value check * cfg.mk (local-checks-to-skip): Enable sc_cast_of_x_alloc_return_value. * .x-sc_cast_of_x_alloc_return_value: * src/dfa.c (CALLOC, MALLOC, REALLOC): Remove casts. * src/dosbuf.c (undossify_input): Likewise. * src/grep.c (print_line_middle, prepend_default_options): Likewise. --- .x-sc_cast_of_x_alloc_return_value | 1 + cfg.mk | 1 - src/dfa.c | 6 +++--- src/dosbuf.c | 7 +++---- src/grep.c | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) create mode 100644 .x-sc_cast_of_x_alloc_return_value diff --git a/.x-sc_cast_of_x_alloc_return_value b/.x-sc_cast_of_x_alloc_return_value new file mode 100644 index 0000000..748e1b0 --- /dev/null +++ b/.x-sc_cast_of_x_alloc_return_value @@ -0,0 +1 @@ +lib/regex.c diff --git a/cfg.mk b/cfg.mk index 92aee2f..b222ff3 100644 --- a/cfg.mk +++ b/cfg.mk @@ -23,7 +23,6 @@ gpg_key_ID = B9AB9A16 # Tests not to run as part of "make distcheck". local-checks-to-skip = \ sc_cast_of_argument_to_free \ - sc_cast_of_x_alloc_return_value \ sc_error_message_uppercase \ sc_m4_quote_check \ sc_makefile_TAB_only_indentation \ diff --git a/src/dfa.c b/src/dfa.c index 6917ceb..47ec093 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -173,9 +173,9 @@ xrealloc (ptr_t p, size_t n) return r; } -#define CALLOC(p, t, n) ((p) = (t *) xcalloc((size_t)(n), sizeof (t))) -#define MALLOC(p, t, n) ((p) = (t *) xmalloc((n) * sizeof (t))) -#define REALLOC(p, t, n) ((p) = (t *) xrealloc((ptr_t) (p), (n) * sizeof (t))) +#define CALLOC(p, t, n) ((p) = xcalloc((size_t)(n), sizeof (t))) +#define MALLOC(p, t, n) ((p) = xmalloc((n) * sizeof (t))) +#define REALLOC(p, t, n) ((p) = xrealloc((ptr_t) (p), (n) * sizeof (t))) /* Reallocate an array of type t if nalloc is too small for index. */ #define REALLOC_IF_NECESSARY(p, t, nalloc, index) \ diff --git a/src/dosbuf.c b/src/dosbuf.c index be64952..664bb90 100644 --- a/src/dosbuf.c +++ b/src/dosbuf.c @@ -125,10 +125,9 @@ undossify_input (register char *buf, size_t buflen) if (inp_map_idx >= dos_pos_map_size - 1) { dos_pos_map_size = inp_map_idx ? inp_map_idx * 2 : 1000; - dos_pos_map = - (struct dos_map *)xrealloc((char *)dos_pos_map, - dos_pos_map_size * - sizeof(struct dos_map)); + dos_pos_map = xrealloc((char *)dos_pos_map, + dos_pos_map_size * + sizeof(struct dos_map)); } if (!inp_map_idx) diff --git a/src/grep.c b/src/grep.c index 6539d4c..564166e 100644 --- a/src/grep.c +++ b/src/grep.c @@ -796,7 +796,7 @@ print_line_middle (const char *beg, const char *lim, { int i = lim - beg; - ibeg = buf = (char *) xmalloc(i); + ibeg = buf = xmalloc(i); /* This can't possibly be correct with UTF-8, but it's equivalent to what was there so far. */ while (--i >= 0) @@ -1620,7 +1620,7 @@ prepend_default_options (char const *options, int *pargc, char ***pargv) int prepended = prepend_args (options, buf, (char **) NULL); int argc = *pargc; char * const *argv = *pargv; - char **pp = (char **) xmalloc ((prepended + argc + 1) * sizeof *pp); + char **pp = xmalloc ((prepended + argc + 1) * sizeof *pp); *pargc = prepended + argc; *pargv = pp; *pp++ = *argv++; -- 1.6.6.rc3.271.g3d40f >From ecb0e55a4a278752032175ad8c628ec20388734a Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 4 Dec 2009 23:35:23 +0100 Subject: [PATCH 3/4] maint: enable prohibit_have_config_h check * cfg.mk (local-checks-to-skip): Enable sc_prohibit_have_config_h * lib/regex.c: Remove useless cpp test of HAVE_CONFIG_H. * lib/savedir.c: Likewise. * src/grep.c: Likewise. * src/kwset.c: Likewise. * src/search.c: Likewise. --- cfg.mk | 1 - lib/regex.c | 4 +--- lib/savedir.c | 4 +--- src/grep.c | 4 +--- src/kwset.c | 4 +--- src/search.c | 4 +--- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/cfg.mk b/cfg.mk index b222ff3..364c4fe 100644 --- a/cfg.mk +++ b/cfg.mk @@ -26,7 +26,6 @@ local-checks-to-skip = \ sc_error_message_uppercase \ sc_m4_quote_check \ sc_makefile_TAB_only_indentation \ - sc_prohibit_have_config_h \ sc_prohibit_magic_number_exit \ sc_prohibit_strcmp \ sc_space_tab \ diff --git a/lib/regex.c b/lib/regex.c index 6ad5c53..6ec4cb0 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -27,9 +27,7 @@ #undef _GNU_SOURCE #define _GNU_SOURCE -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #ifndef PARAMS # if defined __GNUC__ || (defined __STDC__ && __STDC__) diff --git a/lib/savedir.c b/lib/savedir.c index e2c015a..c60e7c0 100644 --- a/lib/savedir.c +++ b/lib/savedir.c @@ -18,9 +18,7 @@ /* Written by David MacKenzie <[email protected]>. */ -#if HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #include <sys/types.h> #include <unistd.h> diff --git a/src/grep.c b/src/grep.c index 564166e..c16c0fb 100644 --- a/src/grep.c +++ b/src/grep.c @@ -19,9 +19,7 @@ /* Written July 1992 by Mike Haertel. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #include <sys/types.h> #include <sys/stat.h> #if defined(HAVE_MMAP) diff --git a/src/kwset.c b/src/kwset.c index 2d90ca5..40b6a6f 100644 --- a/src/kwset.c +++ b/src/kwset.c @@ -29,9 +29,7 @@ String Matching: An Aid to Bibliographic Search," CACM June 1975, Vol. 18, No. 6, which describes the failure function used below. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #include <sys/types.h> #include "system.h" #include "kwset.h" diff --git a/src/search.c b/src/search.c index e4698ff..15516b1 100644 --- a/src/search.c +++ b/src/search.c @@ -18,9 +18,7 @@ /* Written August 1992 by Mike Haertel. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include <config.h> #include <sys/types.h> -- 1.6.6.rc3.271.g3d40f >From d038616cd1dfced11015b8a8a2f52e61f513de7e Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 11 Dec 2009 21:45:36 +0100 Subject: [PATCH 4/4] build: update gnulib submodule to latest --- build-aux/.gitignore | 1 + gnulib | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/build-aux/.gitignore b/build-aux/.gitignore index 016b26a..5734ae4 100644 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@ -1,4 +1,5 @@ announce-gen +arg-nonnull.h config.guess config.rpath config.sub diff --git a/gnulib b/gnulib index c5588be..a3255b1 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit c5588be343f580be8e87d99e043dcdf3d7606759 +Subproject commit a3255b1b9848874572e0df9d0609e263da50de4b -- 1.6.6.rc3.271.g3d40f
