Re: xstrtol upstream change

Eric Blake <[email protected]>
Newsgroups gmane.comp.gnu.m4.patches
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 8/8/2007 2:09 PM:
> Eric Blake <ebb9 <at> byu.net> writes:
> 
>> In an effort to make xstrtol strings easier to translate, gnulib changed its 
>> interface.

And it changed again.  This time, I think it's pretty stable, so hopefully
we don't have to revisit this again later this week.

2007-08-11  Eric Blake  <[email protected]>

	Another upstream xstrtol change.
	* bootstrap (src_modules): getopt is now pulled into libgnu.a, no
	need to grab it separately.
	* src/main.c (OPT_STR, LONG_OPT_STR, short_opt_str, OPT_STR_INIT):
	No longer needed.
	(size_opt): Adjust to latest xstrtol interface.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGvdq484KuGfSFAYARAn9GAJ4rvK9b7uLI05hB8d4JHb4exkZMnwCghLAa
m5b4dNEQI/tmliJ3x9Ud+4w=
=zNHA
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch281 (text/plain, 3.7 KB)
Index: bootstrap
===================================================================
RCS file: /sources/m4/m4/bootstrap,v
retrieving revision 1.49
diff -u -p -r1.49 bootstrap
--- bootstrap	7 Aug 2007 03:15:24 -0000	1.49
+++ bootstrap	11 Aug 2007 15:43:17 -0000
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# bootstrap (GNU M4) version 2007-07-24
+# bootstrap (GNU M4) version 2007-08-11
 # Written by Gary V. Vaughan  <[email protected]>
 
 # Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
@@ -70,7 +70,7 @@ bailout_cb=:
 
 # List dependencies here too; we don't extract them, otherwise dependent
 # modules could end up being imported to src/ *and* gnu/!
-src_modules='getopt version-etc-fsf version-etc'
+src_modules='version-etc-fsf version-etc'
 
 dirname="s,/[^/]*$,,"
 basename="s,^.*/,,g"
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.115
diff -u -p -r1.115 main.c
--- src/main.c	7 Aug 2007 20:59:23 -0000	1.115
+++ src/main.c	11 Aug 2007 15:43:17 -0000
@@ -216,37 +216,12 @@ enum
   VERSION_OPTION			/* no short opt */
 };
 
-/* Use OPT_IDX to decide whether to return either a short option
-   string "-C", or a long option string derived from LONG_OPTIONS.
-   OPT_IDX is -1 if the short option C was used; otherwise it is an
-   index into LONG_OPTIONS, which should have a name preceded by two
-   '-' characters.  */
-#define OPT_STR(opt_idx, c, long_options)	\
-  ((opt_idx) < 0				\
-   ? short_opt_str (c)				\
-   : LONG_OPT_STR (opt_idx, long_options))
-
-/* Likewise, but assume OPT_IDX is nonnegative.  */
-#define LONG_OPT_STR(opt_idx, long_options) ((long_options)[opt_idx].name - 2)
-
-/* Given the byte, C, return the string "-C" in static storage.  */
-static inline char *
-short_opt_str (char c)
-{
-  static char opt_str_storage[3] = {'-', 0, 0};
-  opt_str_storage[1] = c;
-  return opt_str_storage;
-}
-
-/* Define an option string that will be used with OPT_STR or LONG_OPT_STR.  */
-#define OPT_STR_INIT(name) ("--" name + 2)
-
 /* Decode options and launch execution.  */
 static const struct option long_options[] =
 {
   {"batch", no_argument, NULL, 'b'},
   {"debug", optional_argument, NULL, 'd'},
-  {OPT_STR_INIT ("debuglen"), required_argument, NULL, 'l'},
+  {"debuglen", required_argument, NULL, 'l'},
   {"debugmode", optional_argument, NULL, 'd'},
   {"define", required_argument, NULL, 'D'},
   {"discard-comments", no_argument, NULL, 'c'},
@@ -257,7 +232,7 @@ static const struct option long_options[
   {"interactive", no_argument, NULL, 'i'},
   {"load-module", required_argument, NULL, 'm'},
   {"module-directory", required_argument, NULL, 'M'},
-  {OPT_STR_INIT ("nesting-limit"), required_argument, NULL, 'L'},
+  {"nesting-limit", required_argument, NULL, 'L'},
   {"posix", no_argument, NULL, 'G'},
   {"prefix-builtins", no_argument, NULL, 'P'},
   {"pushdef", required_argument, NULL, 'p'},
@@ -272,7 +247,7 @@ static const struct option long_options[
   {"undefine", required_argument, NULL, 'U'},
   {"warnings", no_argument, NULL, 'W'},
 
-  {OPT_STR_INIT ("arglength"), required_argument, NULL, ARGLENGTH_OPTION},
+  {"arglength", required_argument, NULL, ARGLENGTH_OPTION},
   {"debugfile", required_argument, NULL, DEBUGFILE_OPTION},
   {"diversions", required_argument, NULL, DIVERSIONS_OPTION},
   {"hashsize", required_argument, NULL, HASHSIZE_OPTION},
@@ -317,7 +292,7 @@ size_opt (char const *opt, int oi, int o
   if (SIZE_MAX < size && status == LONGINT_OK)
     status = LONGINT_OVERFLOW;
   if (status != LONGINT_OK)
-    STRTOL_FATAL_ERROR (OPT_STR (oi, optchar, long_options), opt, status);
+    xstrtol_fatal (status, oi, optchar, long_options, opt);
   return size;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.