Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Cluster Development (http://www.linux-archive.org/cluster-development/)
-   -   rgmanager: reslist: nothing avoids using size_t (http://www.linux-archive.org/cluster-development/653411-rgmanager-reslist-nothing-avoids-using-size_t.html)

Jan Pokorný 04-06-2012 05:44 PM

rgmanager: reslist: nothing avoids using size_t
 
+ fix comment typo

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
---
reslist.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/reslist.c b/reslist.c
index e1695fb..f9924cd 100644
--- a/reslist.c
+++ b/reslist.c
@@ -70,7 +70,7 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
resource_t *res;
resource_attr_t *ra;
char *c, p_type[32];
- ssize_t len;
+ size_t len;
int x;

if (!node)
@@ -99,11 +99,13 @@ _attr_value(resource_node_t *node, const char *attrname, const char *ptype)
c = strchr(ra->ra_value, '%');
if (!c) {
/* Someone doesn't care or uses older
- semantics on inheritance */
+ semantics of inheritance */
return _attr_value(node->rn_parent, ra->ra_value,
NULL);
}

+ /* Difference guaranteed to be non-negative
+ (for x >= 0: &ra->ra_value[x] >= &ra->ra_value[0]) */
len = (c - ra->ra_value);
memset(p_type, 0, sizeof(p_type));
memcpy(p_type, ra->ra_value, len);
--
1.7.3.4


All times are GMT. The time now is 05:59 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.