Re: [xml] Problem with xmlListAppend

On Wed, May 09, 2007 at 02:15:52PM +0200, Georges-André SILBER wrote:


The code of xmlListAppend() in list.c (from current trunk) is  
incorrect. It returns 1 when there is no error and 0 (or 1!) when  
there is an error.
I think this should be corrected as follows:

Index: list.c
--- list.c      (revision 3613)
+++ list.c      (working copy)
@@ -314,14 +314,14 @@
      if (lkNew == NULL) {
                         "Cannot initialize memory for new link");
-        return (0);
+        return (1);
      lkNew->data = data;
      lkNew->next = lkPlace->next;
      (lkPlace->next)->prev = lkNew;
      lkPlace->next = lkNew;
      lkNew->prev = lkPlace;
-    return 1;
+    return 0;

  Hum, right, I would normally try to avoid changing the functional behaviour
but all other functions in that module also return 1 in case of failure so
that would not be consistent (plus the case l == NULL do return 1), I checked
and xmlListAppend() is used only once in libxml2 (and we don't check the return
value :-( ) 
  So I also fixed valid.c where this was called, commited in SVN,

    thanks !


Red Hat Virtualization group
Daniel Veillard      | virtualization library
veillard redhat com  | libxml GNOME XML XSLT toolkit | Rpmfind RPM search engine

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