Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: include by andrew from 
      ([email protected])
   2. Linux-HA CVS: lib by andrew from 
      ([email protected])
   3. Linux-HA CVS: lib by andrew from 
      ([email protected])
   4. Linux-HA CVS: crm by andrew from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Fri, 16 Jun 2006 04:07:17 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/crm


Modified Files:
        crm.h 


Log Message:
Patch from Bron Gondwana for not using a static array for unpacking XML from 
stdin.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/crm/crm.h,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -3 -r1.97 -r1.98
--- crm.h       23 May 2006 07:50:50 -0000      1.97
+++ crm.h       16 Jun 2006 10:07:16 -0000      1.98
@@ -1,4 +1,4 @@
-/* $Id: crm.h,v 1.97 2006/05/23 07:50:50 andrew Exp $ */
+/* $Id: crm.h,v 1.98 2006/06/16 10:07:16 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -279,8 +279,16 @@
                        crm_crit("Out of memory... exiting");           \
                        cl_flush_logs();                                \
                        exit(1);                                        \
-               } else {                                                \
-                       memset(new_obj, 0, length);                     \
+               }                                                       \
+               memset(new_obj, 0, length);                             \
+       }
+#  define crm_realloc(new_obj,length)                                  \
+       {                                                               \
+               new_obj = realloc(new_obj, length);                     \
+               if(new_obj == NULL) {                                   \
+                       crm_crit("Out of memory... exiting");           \
+                       cl_flush_logs();                                \
+                       exit(1);                                        \
                }                                                       \
        }
 #  define crm_free(x) if(x) { free(x); x=NULL; }
@@ -303,6 +311,21 @@
                }                                                       \
                memset(new_obj, 0, length);                             \
        }
+/* it's not a memory leak to already have an object to realloc, that's
+ * the usual case, however if it does have a value, it must have been
+ * allocated by the same allocator! */ 
+#    define crm_realloc(new_obj,length)                                        
\
+       {                                                               \
+               if (new_obj != NULL) {                                  \
+                       CRM_ASSERT(cl_is_allocated(new_obj) == 1);      \
+               }                                                       \
+               new_obj = cl_realloc(new_obj, length);                  \
+               if(new_obj == NULL) {                                   \
+                       crm_crit("Out of memory... exiting");           \
+                       cl_flush_logs();                                \
+                       abort();                                        \
+               }                                                       \
+       }
 #    define crm_free(x) if(x) {                                \
                CRM_ASSERT(cl_is_allocated(x) == 1);    \
                cl_free(x);                             \
@@ -319,6 +342,15 @@
                }                                                       \
                memset(new_obj, 0, length);                             \
        }
+#    define crm_realloc(new_obj,length)                                        
\
+       {                                                               \
+               new_obj = cl_realloc(new_obj, length);                  \
+               if(new_obj == NULL) {                                   \
+                       crm_crit("Out of memory... exiting");           \
+                       cl_flush_logs();                                \
+                       abort();                                        \
+               }                                                       \
+       }
 #    define crm_free(x) if(x) {                                \
                cl_free(x);                             \
                x=NULL;                         \




------------------------------

Message: 2
Date: Fri, 16 Jun 2006 04:07:17 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/crm/common


Modified Files:
        xml.c 


Log Message:
Patch from Bron Gondwana for not using a static array for unpacking XML from 
stdin.

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/xml.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -3 -r1.92 -r1.93
--- xml.c       8 Jun 2006 16:52:06 -0000       1.92
+++ xml.c       16 Jun 2006 10:07:16 -0000      1.93
@@ -1,4 +1,4 @@
-/* $Id: xml.c,v 1.92 2006/06/08 16:52:06 andrew Exp $ */
+/* $Id: xml.c,v 1.93 2006/06/16 10:07:16 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -43,6 +43,8 @@
 #endif
 #include <crm/dmalloc_wrapper.h>
 
+#define XML_BUFFER_SIZE        4096
+
 int is_comment_start(const char *input);
 int is_comment_end(const char *input);
 gboolean drop_comments(const char *input, int *offset);
@@ -472,55 +474,20 @@
 crm_data_t *
 stdin2xml(void) 
 {
-       int lpc = 0;
-       int MAX_XML_BUFFER = 1000000;
-       
-       int ch = 0;
-       gboolean more = TRUE;
-       gboolean inTag = FALSE;
-       FILE *input = stdin;
-
-       char *xml_buffer = NULL;
-       crm_data_t *xml_obj = NULL;
+       size_t data_length = 0;
+       size_t read_chars = 0;
+  
+       char *xml_buffer = NULL;
+       crm_data_t *xml_obj = NULL;
+  
+       do {
+               crm_realloc(xml_buffer, XML_BUFFER_SIZE + data_length + 1);
+               read_chars = fread(xml_buffer + data_length, 1, 
XML_BUFFER_SIZE, stdin);
+               data_length += read_chars;
+       } while (read_chars > 0);
+       
+       xml_buffer[data_length] = '\0';
 
-       crm_malloc0(xml_buffer, (MAX_XML_BUFFER+1));
-       
-       while (more && lpc < MAX_XML_BUFFER) {
-               ch = fgetc(input);
-/*             crm_debug_3("Got [%c]", ch); */
-               switch(ch) {
-                       case EOF: 
-                       case 0:
-                               ch = 0;
-                               more = FALSE; 
-                               xml_buffer[lpc++] = ch;
-                               break;
-                       case '>':
-                       case '<':
-                               inTag = TRUE;
-                               if(ch == '>') { inTag = FALSE; }
-                               xml_buffer[lpc++] = ch;
-                               break;
-                       case '\n':
-                       case '\r':
-                       case '\t':
-                       case ' ':
-                               ch = ' ';
-                               if(inTag) {
-                                       xml_buffer[lpc++] = ch;
-                               } 
-                               break;
-                       default:
-                               xml_buffer[lpc++] = ch;
-                               break;
-               }
-       }
-
-       if(lpc >= MAX_XML_BUFFER) {
-               crm_err("Buffer limit exceeded... please annoy the developers 
to increase this value.");
-               crm_err("Please try reading from a file instead.");
-       }
-       xml_buffer[MAX_XML_BUFFER] = 0;
        xml_obj = string2xml(xml_buffer);
        crm_free(xml_buffer);
 




------------------------------

Message: 3
Date: Fri, 16 Jun 2006 05:03:56 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/crm/pengine


Modified Files:
        complex.c 


Log Message:
Group child properties are supposed to take precent over parent options,
  this got broken at some point after the paras/meta_params split.
Add a regression test to make sure it doesnt break again 

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/pengine/complex.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- complex.c   8 Jun 2006 13:39:10 -0000       1.3
+++ complex.c   16 Jun 2006 11:03:56 -0000      1.4
@@ -1,4 +1,4 @@
-/* $Id: complex.c,v 1.3 2006/06/08 13:39:10 andrew Exp $ */
+/* $Id: complex.c,v 1.4 2006/06/16 11:03:56 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -157,15 +157,11 @@
                xml_obj, prop_name, prop_value,
                add_hash_param((*rsc)->meta, prop_name, prop_value);
                );
-       
+
        unpack_instance_attributes(
                xml_obj, XML_TAG_META_SETS, NULL, (*rsc)->meta,
                NULL, data_set->now);
 
-       if(parent != NULL) {
-               g_hash_table_foreach(parent->meta, dup_attr, (*rsc)->meta);
-       }       
-
        /* populate from the regular attributes until the GUI can create
         * meta attributes
         */
@@ -174,6 +170,7 @@
                NULL, data_set->now);
 
        if(parent != NULL) {
+               g_hash_table_foreach(parent->meta, dup_attr, (*rsc)->meta);
                g_hash_table_foreach(
                        parent->parameters, dup_attr, (*rsc)->parameters);
        }       




------------------------------

Message: 4
Date: Fri, 16 Jun 2006 05:03:56 -0600 (MDT)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: crm by andrew from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : andrew
Host    : 
Project : linux-ha
Module  : crm

Dir     : linux-ha/crm/pengine/testcases


Added Files:
        group11.dot group11.exp group11.xml 


Log Message:
Group child properties are supposed to take precent over parent options,
  this got broken at some point after the paras/meta_params split.
Add a regression test to make sure it doesnt break again 





------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 31, Issue 53
********************************************

Reply via email to