public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
@ 2012-08-08 22:08 Dodji Seketeli
  2012-08-09  0:16 ` Daniel Veillard
  2013-06-21 11:13 ` Andrew Haley
  0 siblings, 2 replies; 11+ messages in thread
From: Dodji Seketeli @ 2012-08-08 22:08 UTC (permalink / raw)
  To: GCC Patches; +Cc: Tom Tromey, Andrew Haley, Daniel Veillard

Hello,

This is a fix to prepare the xmlj_io.c file of gnu classpath to a coming
API change in libxml2.

Basically, we were previously accessing fields inside the
xmlOutputBuffer struct of libxml2.  In a coming version of libxml2,
that won't be possible anymore.  Client code will have to use accessor
functions instead.  For the gory details, there is an interestin note
of Daniel Veillard (author of libxml2) at
https://mail.gnome.org/archives/desktop-devel-list/2012-August/msg00007.html.

This patch defines too accessor macros that, depending on the version
of libxml2 we are using will either access the fields of
xmlOutputBuffer directly, or use the new accessor function.

Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.

OK to commit?

libjava/classpath/

	* native/jni/xmlj/xmlj_io.c (GET_XML_OUTPUT_BUFFER_CONTENT)
	(GET_XML_OUTPUT_BUFFER_SIZE): New macros.
	(xmljOutputWriteCallback): Use them.
---
 libjava/classpath/native/jni/xmlj/xmlj_io.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/libjava/classpath/native/jni/xmlj/xmlj_io.c b/libjava/classpath/native/jni/xmlj/xmlj_io.c
index aa2964d..a55e48d 100644
--- a/libjava/classpath/native/jni/xmlj/xmlj_io.c
+++ b/libjava/classpath/native/jni/xmlj/xmlj_io.c
@@ -102,6 +102,19 @@ xmljFreeOutputStreamContext (OutputStreamContext * outContext);
 xmlCharEncoding
 xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer);
 
+
+#ifdef LIBXML2_NEW_BUFFER
+#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) (gchar *) \
+  (char *) xmlOutputBufferGetContent(buf)
+#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
+  xmlOutputBufferGetSize(buf)
+#else
+#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) \
+ (buf)->buffer->content
+#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
+  (buf)->buffer->use
+#endif
+
 int
 xmljOutputWriteCallback (void *context, const char *buffer, int len)
 {
@@ -752,9 +765,10 @@ xmljLoadExternalEntity (const char *URL, const char *ID,
       inputStream->directory = NULL;
       inputStream->buf = inputBuffer;
 
-      inputStream->base = inputStream->buf->buffer->content;
-      inputStream->cur = inputStream->buf->buffer->content;
-      inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
+      inputStream->base = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
+      inputStream->cur = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
+      inputStream->end =
+      &inputStream->base[GET_XML_OUTPUT_BUFFER_SIZE (inputStream->buf)];
       if ((ctxt->directory == NULL) && (inputStream->directory != NULL))
         ctxt->directory =
           (char *) xmlStrdup ((const xmlChar *) inputStream->directory);
-- 
		Dodji

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2012-08-08 22:08 [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer Dodji Seketeli
@ 2012-08-09  0:16 ` Daniel Veillard
  2013-06-21 11:13 ` Andrew Haley
  1 sibling, 0 replies; 11+ messages in thread
From: Daniel Veillard @ 2012-08-09  0:16 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: GCC Patches, Tom Tromey, Andrew Haley

On Thu, Aug 09, 2012 at 12:08:20AM +0200, Dodji Seketeli wrote:
> Hello,
> 
> This is a fix to prepare the xmlj_io.c file of gnu classpath to a coming
> API change in libxml2.
> 
> Basically, we were previously accessing fields inside the
> xmlOutputBuffer struct of libxml2.  In a coming version of libxml2,
> that won't be possible anymore.  Client code will have to use accessor
> functions instead.  For the gory details, there is an interestin note
> of Daniel Veillard (author of libxml2) at
> https://mail.gnome.org/archives/desktop-devel-list/2012-August/msg00007.html.
> 
> This patch defines too accessor macros that, depending on the version
> of libxml2 we are using will either access the fields of
> xmlOutputBuffer directly, or use the new accessor function.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
> 
> OK to commit?

  For the record, I rewieved the patch and it looks fine to me,

    thanks Dodji !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2012-08-08 22:08 [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer Dodji Seketeli
  2012-08-09  0:16 ` Daniel Veillard
@ 2013-06-21 11:13 ` Andrew Haley
  2013-06-21 11:19   ` Daniel Veillard
  2013-06-24  8:13   ` Dodji Seketeli
  1 sibling, 2 replies; 11+ messages in thread
From: Andrew Haley @ 2013-06-21 11:13 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: GCC Patches, Tom Tromey, Daniel Veillard

On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
> OK to commit?

Looks good, but what sets LIBXML2_NEW_BUFFER ?

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2013-06-21 11:13 ` Andrew Haley
@ 2013-06-21 11:19   ` Daniel Veillard
  2013-06-21 12:03     ` Andrew Haley
  2013-06-24  8:13   ` Dodji Seketeli
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Veillard @ 2013-06-21 11:19 UTC (permalink / raw)
  To: Andrew Haley; +Cc: Dodji Seketeli, GCC Patches, Tom Tromey

On Fri, Jun 21, 2013 at 12:13:35PM +0100, Andrew Haley wrote:
> On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
> > OK to commit?
> 
> Looks good, but what sets LIBXML2_NEW_BUFFER ?

  I lack context but I think I can answer that one :)

LIBXML2_NEW_BUFFER is a libxml2 public macro from <libxml/tree.h>

/*
 * LIBXML2_NEW_BUFFER:
 *
 * Macro used to express that the API use the new buffers for
 * xmlParserInputBuffer and xmlOutputBuffer. The change was
 * introduced in 2.9.0.
 */

http://xmlsoft.org/html/libxml-tree.html#LIBXML2_NEW_BUFFER

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard@redhat.com  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2013-06-21 11:19   ` Daniel Veillard
@ 2013-06-21 12:03     ` Andrew Haley
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Haley @ 2013-06-21 12:03 UTC (permalink / raw)
  To: veillard; +Cc: Dodji Seketeli, GCC Patches, Tom Tromey

On 06/21/2013 12:19 PM, Daniel Veillard wrote:
> On Fri, Jun 21, 2013 at 12:13:35PM +0100, Andrew Haley wrote:
>> On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
>>> OK to commit?
>>
>> Looks good, but what sets LIBXML2_NEW_BUFFER ?
> 
>   I lack context but I think I can answer that one :)
> 
> LIBXML2_NEW_BUFFER is a libxml2 public macro from <libxml/tree.h>
> 
> /*
>  * LIBXML2_NEW_BUFFER:
>  *
>  * Macro used to express that the API use the new buffers for
>  * xmlParserInputBuffer and xmlOutputBuffer. The change was
>  * introduced in 2.9.0.
>  */
> 
> http://xmlsoft.org/html/libxml-tree.html#LIBXML2_NEW_BUFFER

Sure, but there's no point adding it to libgcj if it's not set by
anything.  It needs an autoconf macro or somesuch.

Andrew.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2013-06-21 11:13 ` Andrew Haley
  2013-06-21 11:19   ` Daniel Veillard
@ 2013-06-24  8:13   ` Dodji Seketeli
  2013-06-24  8:16     ` Andrew Haley
  1 sibling, 1 reply; 11+ messages in thread
From: Dodji Seketeli @ 2013-06-24  8:13 UTC (permalink / raw)
  To: Andrew Haley; +Cc: GCC Patches, Tom Tromey, Daniel Veillard, Andrew Hughes

[-- Attachment #1: Type: text/plain, Size: 1602 bytes --]

Hello Andrew,

Andrew Haley <aph@redhat.com> writes:

> On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
>> OK to commit?
>
> Looks good,

Thanks.

Just for the record, you acked this patch a year or so ago, but now I
realize it was by private email.  I am attaching the email I received
(as I see there is nothing really private in it) below.

So the patch has been added to gnu classpath, thanks to a commit from
Andrew Hughes that followed your ACK and my committing (inadvertently)
to the copy of gnu classpath in the gcc tree:

http://git.savannah.gnu.org/cgit/classpath.git/commit/?id=4d4db712cf4df4feb4d7b98bb1b5b448218500b3

The email thread is at http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00564.html.

> but what sets LIBXML2_NEW_BUFFER ?

Daniel Veillard <veillard@redhat.com> writes:

> LIBXML2_NEW_BUFFER is a libxml2 public macro from <libxml/tree.h>

Andrew Haley <aph@redhat.com> writes:

>> LIBXML2_NEW_BUFFER is a libxml2 public macro from <libxml/tree.h>

> Sure, but there's no point adding it to libgcj if it's not set by
> anything.  It needs an autoconf macro or somesuch.

Just to make sure I understand what you are saying; do you mean that the
accessor macro GET_XML_OUTPUT_BUFFER_SIZE (that depends on
LIBXML2_NEW_BUFFER) shouldn't be defined in
libjava/classpath/native/jni/xmlj/xmlj_io.c but somewhere else by an
autoconf macro?  If so, maybe you should elaborate more on what you have
in mind exactly as I am not really well acquainted with (the configury
of) gnu classpath.  I did this thing quickly so that the build doesn't
break on newer versions of libxml2.

Cheers.


[-- Attachment #2: Patch ACK from Andrew Haley --]
[-- Type: text/plain, Size: 3188 bytes --]

From: Andrew Haley <aph@redhat.com>
Subject: Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
To: Dodji Seketeli <dodji@redhat.com>
Date: Thu, 09 Aug 2012 10:06:13 +0100 (45 weeks, 3 days, 22 hours ago)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120717 Thunderbird/14.0

On 08/08/2012 11:08 PM, Dodji Seketeli wrote:
> Hello,
> 
> This is a fix to prepare the xmlj_io.c file of gnu classpath to a coming
> API change in libxml2.
> 
> Basically, we were previously accessing fields inside the
> xmlOutputBuffer struct of libxml2.  In a coming version of libxml2,
> that won't be possible anymore.  Client code will have to use accessor
> functions instead.  For the gory details, there is an interestin note
> of Daniel Veillard (author of libxml2) at
> https://mail.gnome.org/archives/desktop-devel-list/2012-August/msg00007.html.
> 
> This patch defines too accessor macros that, depending on the version
> of libxml2 we are using will either access the fields of
> xmlOutputBuffer directly, or use the new accessor function.
> 
> Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk.
> 
> OK to commit?

OK.

Thanks,
Andrew.


> libjava/classpath/
> 
> 	* native/jni/xmlj/xmlj_io.c (GET_XML_OUTPUT_BUFFER_CONTENT)
> 	(GET_XML_OUTPUT_BUFFER_SIZE): New macros.
> 	(xmljOutputWriteCallback): Use them.
> ---
>  libjava/classpath/native/jni/xmlj/xmlj_io.c |   20 +++++++++++++++++---
>  1 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/libjava/classpath/native/jni/xmlj/xmlj_io.c b/libjava/classpath/native/jni/xmlj/xmlj_io.c
> index aa2964d..a55e48d 100644
> --- a/libjava/classpath/native/jni/xmlj/xmlj_io.c
> +++ b/libjava/classpath/native/jni/xmlj/xmlj_io.c
> @@ -102,6 +102,19 @@ xmljFreeOutputStreamContext (OutputStreamContext * outContext);
>  xmlCharEncoding
>  xmljDetectCharEncoding (JNIEnv * env, jbyteArray buffer);
>  
> +
> +#ifdef LIBXML2_NEW_BUFFER
> +#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) (gchar *) \
> +  (char *) xmlOutputBufferGetContent(buf)
> +#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
> +  xmlOutputBufferGetSize(buf)
> +#else
> +#define GET_XML_OUTPUT_BUFFER_CONTENT(buf) \
> + (buf)->buffer->content
> +#define GET_XML_OUTPUT_BUFFER_SIZE(buf) \
> +  (buf)->buffer->use
> +#endif
> +
>  int
>  xmljOutputWriteCallback (void *context, const char *buffer, int len)
>  {
> @@ -752,9 +765,10 @@ xmljLoadExternalEntity (const char *URL, const char *ID,
>        inputStream->directory = NULL;
>        inputStream->buf = inputBuffer;
>  
> -      inputStream->base = inputStream->buf->buffer->content;
> -      inputStream->cur = inputStream->buf->buffer->content;
> -      inputStream->end = &inputStream->base[inputStream->buf->buffer->use];
> +      inputStream->base = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
> +      inputStream->cur = GET_XML_OUTPUT_BUFFER_CONTENT (inputStream->buf);
> +      inputStream->end =
> +      &inputStream->base[GET_XML_OUTPUT_BUFFER_SIZE (inputStream->buf)];
>        if ((ctxt->directory == NULL) && (inputStream->directory != NULL))
>          ctxt->directory =
>            (char *) xmlStrdup ((const xmlChar *) inputStream->directory);
> 


[-- Attachment #3: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2013-06-24  8:13   ` Dodji Seketeli
@ 2013-06-24  8:16     ` Andrew Haley
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Haley @ 2013-06-24  8:16 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: GCC Patches, Tom Tromey, Daniel Veillard, Andrew Hughes

On 06/24/2013 09:13 AM, Dodji Seketeli wrote:
> Just to make sure I understand what you are saying; do you mean that the
> accessor macro GET_XML_OUTPUT_BUFFER_SIZE (that depends on
> LIBXML2_NEW_BUFFER) shouldn't be defined in
> libjava/classpath/native/jni/xmlj/xmlj_io.c but somewhere else by an
> autoconf macro?  If so, maybe you should elaborate more on what you have
> in mind exactly as I am not really well acquainted with (the configury
> of) gnu classpath.  I did this thing quickly so that the build doesn't
> break on newer versions of libxml2.

OK, I get it now, thanks.

Andrew.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2012-08-09 15:02     ` Dodji Seketeli
@ 2012-08-09 20:04       ` Andrew Hughes
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Hughes @ 2012-08-09 20:04 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: Andrew Haley, GCJ-patches, GCC Patches



----- Original Message -----
> Andrew Hughes <ahughes@redhat.com> writes:
> 
> > Don't worry about reverting it.  I'll add it to Classpath now, then
> > they'll be in sync when we do the next merge.
> 
> Thank you.
> 

Done: http://git.savannah.gnu.org/cgit/classpath.git/commit/?id=4d4db712cf4df4feb4d7b98bb1b5b448218500b3

> > In future, please post changes to files under the libjava/classpath
> > directory to
> > classpath@gnu.org and feel free to ping me directly if you don't
> > get a response in a reasonable timeframe.  It just makes my life a
> > bit
> > easier when it comes to doing the merges :-)
> 
> OK, I will do.  Sorry for the inconvenience.

No worries.  It's not immediately obvious for someone new to the libjava codebase.

> 
> --
> 		Dodji
> 

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2012-08-09 14:40   ` Andrew Hughes
@ 2012-08-09 15:02     ` Dodji Seketeli
  2012-08-09 20:04       ` Andrew Hughes
  0 siblings, 1 reply; 11+ messages in thread
From: Dodji Seketeli @ 2012-08-09 15:02 UTC (permalink / raw)
  To: Andrew Hughes; +Cc: Andrew Haley, GCJ-patches, GCC Patches

Andrew Hughes <ahughes@redhat.com> writes:

> Don't worry about reverting it.  I'll add it to Classpath now, then
> they'll be in sync when we do the next merge.

Thank you.

> In future, please post changes to files under the libjava/classpath directory to
> classpath@gnu.org and feel free to ping me directly if you don't
> get a response in a reasonable timeframe.  It just makes my life a bit
> easier when it comes to doing the merges :-)

OK, I will do.  Sorry for the inconvenience.

-- 
		Dodji

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
  2012-08-09 13:42 ` Dodji Seketeli
@ 2012-08-09 14:40   ` Andrew Hughes
  2012-08-09 15:02     ` Dodji Seketeli
  0 siblings, 1 reply; 11+ messages in thread
From: Andrew Hughes @ 2012-08-09 14:40 UTC (permalink / raw)
  To: Dodji Seketeli; +Cc: Andrew Haley, GCJ-patches, GCC Patches

----- Original Message -----
> Andrew Hughes <ahughes@redhat.com> writes:
> 
> >> OK.
> >> 
> >
> > As this is a GNU Classpath change, it should go in there first to
> > avoid creating
> > a divergence which will cause later problems in merging.  Classpath
> > is regularly
> > merged into gcj as a whole.
> >
> > I found several patches during the last merge which had only been
> > added to gcj
> > (some without ChangeLog entries) and this slowed the process down
> > considerably.
> >
> > Dodji, I can push this to Classpath on your behalf if you don't
> > have commit
> > access.
> 
> Oops.  I committed the patch before I saw your message.  Sorry.
> 
> If you agree, I can revert the commit so that you can commit it to
> classpath then.  I don't think I have commit access to GNU classpath.
> 
> Sorry for the inconvenience.
> 

Don't worry about reverting it.  I'll add it to Classpath now, then
they'll be in sync when we do the next merge.

In future, please post changes to files under the libjava/classpath directory to
classpath@gnu.org and feel free to ping me directly if you don't
get a response in a reasonable timeframe.  It just makes my life a bit
easier when it comes to doing the merges :-)

> --
> 		Dodji
> 

-- 
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

PGP Key: 248BDC07 (https://keys.indymedia.org/)
Fingerprint = EC5A 1F5E C0AD 1D15 8F1F  8F91 3B96 A578 248B DC07

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer
       [not found] <1881397545.2449318.1344509333013.JavaMail.root@redhat.com>
@ 2012-08-09 13:42 ` Dodji Seketeli
  2012-08-09 14:40   ` Andrew Hughes
  0 siblings, 1 reply; 11+ messages in thread
From: Dodji Seketeli @ 2012-08-09 13:42 UTC (permalink / raw)
  To: Andrew Hughes; +Cc: Andrew Haley, GCJ-patches, GCC Patches

Andrew Hughes <ahughes@redhat.com> writes:

>> OK.
>> 
>
> As this is a GNU Classpath change, it should go in there first to avoid creating
> a divergence which will cause later problems in merging.  Classpath is regularly
> merged into gcj as a whole.
>
> I found several patches during the last merge which had only been added to gcj
> (some without ChangeLog entries) and this slowed the process down considerably.
>
> Dodji, I can push this to Classpath on your behalf if you don't have commit
> access.

Oops.  I committed the patch before I saw your message.  Sorry.

If you agree, I can revert the commit so that you can commit it to
classpath then.  I don't think I have commit access to GNU classpath.

Sorry for the inconvenience.

-- 
		Dodji

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-06-24  8:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-08 22:08 [PATCH, libjava] Use accessor functions to manipulate xmlOutputBuffer Dodji Seketeli
2012-08-09  0:16 ` Daniel Veillard
2013-06-21 11:13 ` Andrew Haley
2013-06-21 11:19   ` Daniel Veillard
2013-06-21 12:03     ` Andrew Haley
2013-06-24  8:13   ` Dodji Seketeli
2013-06-24  8:16     ` Andrew Haley
     [not found] <1881397545.2449318.1344509333013.JavaMail.root@redhat.com>
2012-08-09 13:42 ` Dodji Seketeli
2012-08-09 14:40   ` Andrew Hughes
2012-08-09 15:02     ` Dodji Seketeli
2012-08-09 20:04       ` Andrew Hughes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).