On 09/14/2012 08:54 AM, Jim Meyering wrote:
Real fast now!
> +static bool
> +seq_fast (char const *a, char const *b)
> +{
> [...]
> + char *buf = xmalloc (N * (n + 1));
Shouldn't we free(buf), too?
> @@ -412,6 +520,33 @@ main (int argc, char **argv)
> [...]
> + if (format_str == NULL
> + && all_digits_p (argv[1])
> + && (n_args == 1 || all_digits_p (argv[2]))
> + && (n_args < 3 || STREQ ("1", argv[3])))
> + {
> + char const *s1 = n_args == 1 ? "1" : argv[1];
> + char const *s2 = n_args == 1 ? argv[1] : argv[2];
> + if (seq_fast (s1, s2))
> + exit (EXIT_SUCCESS);
> +
> + /* Upon any failure, let the more general code deal with it. */
> + }
seq_fast can only return ok.
BTW:
src/seq.c: In function 'all_digits_p':
src/seq.c:440:1: error: function might be candidate for attribute 'pure' if it
is known to return normally
[-Werror=suggest-attribute=pure]
Therefore:
-static bool
+static bool _GL_ATTRIBUTE_PURE
all_digits_p (char const *s)
Have a nice day,
Berny