[PATCH 2/2] Zero-fill RROutputRec instead of manually clearing all the fields

Mikhail Gusarov dottedmag at dottedmag.net
Sun Jun 6 06:40:10 PDT 2010


Reviewed-by: Mikhail Gusarov <dottedmag at dottedmag.net>
---
 randr/rrproperty.c |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/randr/rrproperty.c b/randr/rrproperty.c
index 7b8e44e..c4dcb1a 100644
--- a/randr/rrproperty.c
+++ b/randr/rrproperty.c
@@ -103,18 +103,10 @@ RRCreateOutputProperty (Atom property)
 {
     RRPropertyPtr   prop;
 
-    prop = (RRPropertyPtr)malloc(sizeof(RRPropertyRec));
+    prop = calloc(1, sizeof(RRPropertyRec));
     if (!prop)
 	return NULL;
-    prop->next = NULL;
     prop->propertyName = property;
-    prop->is_pending = FALSE;
-    prop->range = FALSE;
-    prop->immutable = FALSE;
-    prop->num_valid = 0;
-    prop->valid_values = NULL;
-    RRInitOutputPropertyValue (&prop->current);
-    RRInitOutputPropertyValue (&prop->pending);
     return prop;
 }
 
-- 
1.7.1



More information about the xorg-devel mailing list