m4-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Eric Blake
Subject: Re: argv_ref patch 25: allow NUL in quote and comment delimiters
Date: Thu, 19 Jun 2008 06:43:16 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080421 Thunderbird/2.0.0.14 Mnenhy/0.7.5.666

-----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             address@hidden
-----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-----
>From d9538dab08563b00b7da9145ac6bda117c35100a Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
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 <address@hidden>
---
 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  <address@hidden>
+
+       Avoid gcc extension.
+       * src/builtin.c (m4_eval): Don't perform arithmetic on void*.
+
 2008-06-18  Eric Blake  <address@hidden>
 
        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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]