[Spice-devel] [PATCH 04/17] Remove casts from void * with xrealloc() calls

Daniel P. Berrange berrange at redhat.com
Tue Jan 10 07:58:25 PST 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

The xrealloc() function returns void*, so the return value
never needs to be cast
---
 common/lines.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/common/lines.c b/common/lines.c
index 9b47ee3..797d5d6 100644
--- a/common/lines.c
+++ b/common/lines.c
@@ -509,17 +509,15 @@ miSubtractSpans (SpanGroup * spanGroup, Spans * sub)
                                 int *newwid;
 
 #define EXTRA 8
-                                newPt =
-                                    (DDXPointPtr) xrealloc (spans->points,
-                                                            (spans->count +
-                                                             EXTRA) * sizeof (DDXPointRec));
+                                newPt = xrealloc (spans->points,
+                                                  (spans->count +
+                                                   EXTRA) * sizeof (DDXPointRec));
                                 if (!newPt)
                                     break;
                                 spansPt = newPt + (spansPt - spans->points);
                                 spans->points = newPt;
-                                newwid =
-                                    (int *) xrealloc (spans->widths,
-                                                      (spans->count + EXTRA) * sizeof (int));
+                                newwid = xrealloc (spans->widths,
+                                                   (spans->count + EXTRA) * sizeof (int));
                                 if (!newwid)
                                     break;
                                 spansWid = newwid + (spansWid - spans->widths);
@@ -556,7 +554,7 @@ miAppendSpans (SpanGroup * spanGroup, SpanGroup * otherGroup, Spans * spans)
     if (spansCount > 0) {
         if (spanGroup->size == spanGroup->count) {
             spanGroup->size = (spanGroup->size + 8) * 2;
-            spanGroup->group = (Spans *)
+            spanGroup->group =
                 xrealloc (spanGroup->group, sizeof (Spans) * spanGroup->size);
         }
 
@@ -803,10 +801,10 @@ miFillUniqueSpanGroup (GCPtr pGC, SpanGroup * spanGroup, Boolean foreground)
                         DDXPointPtr newpoints;
                         int *newwidths;
                         ysizes[index] = (ysizes[index] + 8) * 2;
-                        newpoints = (DDXPointPtr) xrealloc (newspans->points,
-                                                            ysizes[index] * sizeof (DDXPointRec));
-                        newwidths = (int *) xrealloc (newspans->widths,
-                                                      ysizes[index] * sizeof (int));
+                        newpoints = xrealloc (newspans->points,
+                                              ysizes[index] * sizeof (DDXPointRec));
+                        newwidths = xrealloc (newspans->widths,
+                                              ysizes[index] * sizeof (int));
                         if (!newpoints || !newwidths) {
                             int i;
 
-- 
1.7.7.5



More information about the Spice-devel mailing list