Re: argv_ref patch 25: allow NUL in quote and comment delimiters

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 6/18/2008 5:19 PM:
| +    {
| +      min -= len;
| +      obstack_blank (obs, min);
| +      memset (obstack_next_free (obs) - min, '0', min);

This happens to work, since the current "obstack.h" treats
obstack_next_free as a macro that merely exposes a char* field; but the
glibc documentation at
http://www.gnu.org/software/libc/manual/html_mono/libc.html#Summary-of-Obstacks
claims obstack_next_free returns void*.  Therefore, since pointer
arithmetic on void* is a gcc extension, I'm committing this to avoid any
problem on non-gcc compilers if obstack.h is ever changed to more strictly
follow the documentation.

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

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

iEYEARECAAYFAkhaVGQACgkQ84KuGfSFAYCqAACeMMTi0qeqCNaflMQa0FBl5Req
FcsAn0vSUwUt7uVa0ppNIUIuDfWCEa4d
=vDFA
-----END PGP SIGNATURE-----

_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch360 (text/plain, 1.1 KB)
From d9538dab08563b00b7da9145ac6bda117c35100a Mon Sep 17 00:00:00 2001
From: Eric Blake <[email protected]>
Date: Thu, 19 Jun 2008 06:40:48 -0600
Subject: [PATCH] Avoid gcc extension.

* src/builtin.c (m4_eval): Don't perform arithmetic on void*.

Signed-off-by: Eric Blake <[email protected]>
---
 ChangeLog     |    5 +++++
 src/builtin.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 794d6d7..33220e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-19  Eric Blake  <[email protected]>
+
+	Avoid gcc extension.
+	* src/builtin.c (m4_eval): Don't perform arithmetic on void*.
+
 2008-06-18  Eric Blake  <[email protected]>
 
 	Revert speed regression from previous patch.
diff --git a/src/builtin.c b/src/builtin.c
index d64b567..aa108d4 100644
--- a/src/builtin.c
+++ b/src/builtin.c
@@ -1234,7 +1234,7 @@ m4_eval (struct obstack *obs, int argc, macro_arguments *argv)
     {
       min -= len;
       obstack_blank (obs, min);
-      memset (obstack_next_free (obs) - min, '0', min);
+      memset ((char *) obstack_next_free (obs) - min, '0', min);
     }
   obstack_grow (obs, s, len);
 }
-- 
1.5.5.1
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.