Send Linux-ha-cvs mailing list submissions to
        linux-ha-cvs@lists.linux-ha.org

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: lib by andrew from 
      (linux-ha-cvs@lists.linux-ha.org)


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

Message: 1
Date: Mon, 29 May 2006 05:53:54 -0600 (MDT)
From: linux-ha-cvs@lists.linux-ha.org
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:
        ipc.c iso8601.c utils.c xml.c 


Log Message:
Remove redundant use of sizeif(char)... ISO C specifies that sizeof(char) := 1

===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/ipc.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -3 -r1.22 -r1.23
--- ipc.c       7 Apr 2006 15:41:36 -0000       1.22
+++ ipc.c       29 May 2006 11:53:53 -0000      1.23
@@ -1,4 +1,4 @@
-/* $Id: ipc.c,v 1.22 2006/04/07 15:41:36 andrew Exp $ */
+/* $Id: ipc.c,v 1.23 2006/05/29 11:53:53 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -65,10 +65,6 @@
                crm_err("Not connected to Heartbeat");
                all_is_good = FALSE;
                
-       } else if(get_stringlen(msg) >= MAXMSG) {
-               crm_err("Message is too large to send");
-               all_is_good = FALSE;
-
        } else if(node != NULL) {
                if(hb_conn->llc_ops->send_ordered_nodemsg(
                           hb_conn, msg, node) != HA_OK) {
@@ -138,11 +134,6 @@
                crm_log_maybe(fail_level, "IPC Channel to %d is not connected",
                              (int)ipc_client->farside_pid);
                all_is_good = FALSE;
-
-       } else if(get_stringlen(msg) >= MAXMSG) {
-               crm_err("Message is to %d too large to send",
-                       (int)ipc_client->farside_pid);
-               all_is_good = FALSE;
        }
 
        if(all_is_good && msg2ipcchan(msg, ipc_client) != HA_OK) {
@@ -257,7 +248,7 @@
        local_socket_len += strlen(channel_name);
        local_socket_len += strlen(CRM_SOCK_DIR);
 
-       crm_malloc0(commpath, sizeof(char)*local_socket_len);
+       crm_malloc0(commpath, local_socket_len);
        if(commpath != NULL) {
                sprintf(commpath, CRM_SOCK_DIR "/%s", channel_name);
                commpath[local_socket_len - 1] = '\0';
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/iso8601.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- iso8601.c   12 Apr 2006 08:24:20 -0000      1.14
+++ iso8601.c   29 May 2006 11:53:53 -0000      1.15
@@ -1,4 +1,4 @@
-/* $Id: iso8601.c,v 1.14 2006/04/12 08:24:20 andrew Exp $ */
+/* $Id: iso8601.c,v 1.15 2006/05/29 11:53:53 andrew Exp $ */
 /* 
  * Copyright (C) 2005 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -81,7 +81,7 @@
        CRM_CHECK(dt != NULL, return);
        
        if(flags & ha_log_date) {
-               crm_malloc0(date_s, sizeof(char)*(32));
+               crm_malloc0(date_s, 32);
                if(date_s == NULL) {
                } else if(flags & ha_date_weeks) {
                        snprintf(date_s, 31, "%d-W%.2d-%d",
@@ -97,7 +97,7 @@
        }
        if(flags & ha_log_time) {
                int offset = 0;
-               crm_malloc0(time_s, sizeof(char)*(32));
+               crm_malloc0(time_s, 32);
                if(time_s == NULL) {
                        return;
                } 
@@ -109,7 +109,7 @@
                        offset =(dt->offset->hours * 100) + dt->offset->minutes;
                }
                
-               crm_malloc0(offset_s, sizeof(char)*(32));
+               crm_malloc0(offset_s, 32);
                if((flags & ha_log_local) == 0 || offset == 0) {
                        snprintf(offset_s, 31, "Z");
 
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/utils.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -3 -r1.54 -r1.55
--- utils.c     28 May 2006 07:03:37 -0000      1.54
+++ utils.c     29 May 2006 11:53:53 -0000      1.55
@@ -1,4 +1,4 @@
-/* $Id: utils.c,v 1.54 2006/05/28 07:03:37 andrew Exp $ */
+/* $Id: utils.c,v 1.55 2006/05/29 11:53:53 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -80,7 +80,7 @@
        if(local_cust2 == NULL) { local_cust2 = "_empty_"; }
        reference_len += strlen(local_cust2);
        
-       crm_malloc0(since_epoch, reference_len*(sizeof(char)));
+       crm_malloc0(since_epoch, reference_len);
 
        if(since_epoch != NULL) {
                sprintf(since_epoch, "%s-%s-%ld-%u",
@@ -107,7 +107,7 @@
                len = strlen(srcstring);
                while(lpc <= len) {
                        if (srcstring[lpc] == separator) {
-                               crm_malloc0(*name, sizeof(char)*lpc+1);
+                               crm_malloc0(*name, lpc+1);
                                if(*name == NULL) {
                                        break; /* and return FALSE */
                                }
@@ -122,7 +122,7 @@
                                        *value = NULL;
                                } else {
 
-                                       crm_malloc0(*value, sizeof(char)*len+1);
+                                       crm_malloc0(*value, len+1);
                                        if(*value == NULL) {
                                                crm_free(*name);
                                                break; /* and return FALSE */
@@ -155,7 +155,7 @@
        CRM_ASSERT(suffix != NULL);
        len = strlen(prefix) + strlen(suffix) + 2;
 
-       crm_malloc0(new_str, sizeof(char)*(len));
+       crm_malloc0(new_str, (len));
        sprintf(new_str, "%s%c%s", prefix, join, suffix);
        new_str[len-1] = 0;
        return new_str;
@@ -234,7 +234,7 @@
        int len = 32;
        char *buffer = NULL;
        
-       crm_malloc0(buffer, sizeof(char)*(len+1));
+       crm_malloc0(buffer, (len+1));
        if(buffer != NULL) {
                snprintf(buffer, len, "%d", an_int);
        }
@@ -600,7 +600,7 @@
                
        } 
 
-       crm_malloc0(uuid_calc, sizeof(char)*50);
+       crm_malloc0(uuid_calc, 50);
        
        if(uuid_calc == NULL) {
                return NULL;
@@ -916,7 +916,7 @@
        
        len += strlen(op_type);
        len += strlen(rsc_id);
-       crm_malloc0(op_id, sizeof(char)*len);
+       crm_malloc0(op_id, len);
        CRM_CHECK(op_id != NULL, return NULL);
        sprintf(op_id, "%s_%s_%d", rsc_id, op_type, interval);
        return op_id;
@@ -955,7 +955,7 @@
        len += strlen(op_type);
        len += strlen(rsc_id);
        len += strlen(notify_type);
-       crm_malloc0(op_id, sizeof(char)*len);
+       crm_malloc0(op_id, len);
        if(op_id != NULL) {
                sprintf(op_id, "%s_%s_notify_%s_0", rsc_id, notify_type, 
op_type);
        }
@@ -972,7 +972,7 @@
        
        len += strlen(transition_key);
        
-       crm_malloc0(fail_state, sizeof(char)*len);
+       crm_malloc0(fail_state, len);
        if(fail_state != NULL) {
                snprintf(fail_state, len, "%d:%s", op_status,transition_key);
        }
@@ -989,7 +989,7 @@
        
        len += strlen(transition_key);
        
-       crm_malloc0(fail_state, sizeof(char)*len);
+       crm_malloc0(fail_state, len);
        if(fail_state != NULL) {
                snprintf(fail_state, len, "%d:%d;%s",
                         op_status, op_rc, transition_key);
@@ -1041,7 +1041,7 @@
        
        len += strlen(node);
        
-       crm_malloc0(fail_state, sizeof(char)*len);
+       crm_malloc0(fail_state, len);
        if(fail_state != NULL) {
                snprintf(fail_state, len, "%d:%s", transition_id, node);
        }
@@ -1133,11 +1133,11 @@
        }
 
 #if CRM_DEPRECATED_SINCE_2_0_5
-/*     if(version == NULL) { */
+       if(version == NULL || compare_version("1.0.5", version)) {
                for(lpc = 0; lpc < DIMOF(filter_205); lpc++) {
                        xml_remove_prop(param_set, filter_205[lpc]); 
                }
-/*     } */
+       }
 #endif
        
        for(lpc = 0; lpc < DIMOF(attr_filter); lpc++) {
@@ -1251,7 +1251,7 @@
        
        len += strlen(directory);
        len += strlen(series);
-       crm_malloc0(filename, sizeof(char)*len);
+       crm_malloc0(filename, len);
        CRM_CHECK(filename != NULL, return NULL);
 
        if(bzip) {
@@ -1277,7 +1277,7 @@
        
        len += strlen(directory);
        len += strlen(series);
-       crm_malloc0(series_file, sizeof(char)*len);
+       crm_malloc0(series_file, len);
        CRM_CHECK(series_file != NULL, return 0);
        sprintf(series_file, "%s/%s.last", directory, series);
        
@@ -1297,8 +1297,8 @@
        CRM_ASSERT(start == ftell(file_strm));
 
        crm_debug_3("Reading %d bytes from file", length);
-       crm_malloc0(buffer, sizeof(char) * (length+1));
-       read_len = fread(buffer, sizeof(char), length, file_strm);
+       crm_malloc0(buffer, (length+1));
+       read_len = fread(buffer, 1, length, file_strm);
 
        if(read_len != length) {
                crm_err("Calculated and read bytes differ: %d vs. %d",
@@ -1342,7 +1342,7 @@
        
        len += strlen(directory);
        len += strlen(series);
-       crm_malloc0(series_file, sizeof(char)*len);
+       crm_malloc0(series_file, len);
        CRM_CHECK(series_file != NULL, return);
        sprintf(series_file, "%s/%s.last", directory, series);
        
===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/crm/common/xml.c,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -3 -r1.84 -r1.85
--- xml.c       21 May 2006 20:24:23 -0000      1.84
+++ xml.c       29 May 2006 11:53:53 -0000      1.85
@@ -1,4 +1,4 @@
-/* $Id: xml.c,v 1.84 2006/05/21 20:24:23 andrew Exp $ */
+/* $Id: xml.c,v 1.85 2006/05/29 11:53:53 andrew Exp $ */
 /* 
  * Copyright (C) 2004 Andrew Beekhof <[EMAIL PROTECTED]>
  * 
@@ -443,7 +443,7 @@
                return;
        }
        
-       crm_malloc0(since_epoch, 128*(sizeof(char)));
+       crm_malloc0(since_epoch, 128);
        if(since_epoch != NULL) {
                sprintf(since_epoch, "%ld", (unsigned long)a_time);
                ha_msg_mod(a_node, XML_ATTR_TSTAMP, since_epoch);
@@ -483,7 +483,7 @@
        char *xml_buffer = NULL;
        crm_data_t *xml_obj = NULL;
 
-       crm_malloc0(xml_buffer, sizeof(char)*(MAX_XML_BUFFER+1));
+       crm_malloc0(xml_buffer, (MAX_XML_BUFFER+1));
        
        while (more && lpc < MAX_XML_BUFFER) {
                ch = fgetc(input);
@@ -547,8 +547,8 @@
        CRM_ASSERT(start == ftell(input));
 
        crm_debug_3("Reading %d bytes from file", length);
-       crm_malloc0(buffer, sizeof(char) * (length+1));
-       read_len = fread(buffer, sizeof(char), length, input);
+       crm_malloc0(buffer, (length+1));
+       read_len = fread(buffer, 1, length, input);
        if(read_len != length) {
                crm_err("Calculated and read bytes differ: %d vs. %d",
                        length, read_len);
@@ -2207,7 +2207,7 @@
        const char *tag_name = crm_element_name(xml_obj);
        const char *tag_id = ID(xml_obj);
        
-       crm_malloc0(new_uuid_s, sizeof(char)*38);
+       crm_malloc0(new_uuid_s, 38);
        cl_uuid_generate(&new_uuid);
        cl_uuid_unparse(&new_uuid, new_uuid_s);
        
@@ -2447,8 +2447,8 @@
        CRM_CHECK(buffer != NULL && strlen(buffer) > 0,
                  free_xml(sorted); return NULL);
 
-       crm_malloc0(digest, sizeof(char) * (2 * digest_len + 1));
-       crm_malloc0(raw_digest, sizeof(char) * (digest_len + 1));
+       crm_malloc0(digest, (2 * digest_len + 1));
+       crm_malloc0(raw_digest, (digest_len + 1));
        MD5((unsigned char *)buffer, strlen(buffer), raw_digest);
        for(i = 0; i < digest_len; i++) {
                sprintf(digest+(2*i), "%02x", raw_digest[i]);




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

_______________________________________________
Linux-ha-cvs mailing list
Linux-ha-cvs@lists.linux-ha.org
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 30, Issue 94
********************************************

Reply via email to