[haiku-commits] haiku: hrev48639 - src/kits/interface

  • From: pulkomandy@xxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 9 Jan 2015 11:04:48 +0100 (CET)

hrev48639 adds 1 changeset to branch 'master'
old head: 149ce46d14fb60917b78e8f02343112f0ba96978
new head: ce39d3a366f7d7b5c8055aa594f33668cd8724d8
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=ce39d3a+%5E149ce46

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

ce39d3a: BTextView: use calloc to replace malloc+memset
  
  Fixes #11721.

                                 [ Adrien Destugues <pulkomandy@xxxxxxxxx> ]

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

Revision:    hrev48639
Commit:      ce39d3a366f7d7b5c8055aa594f33668cd8724d8
URL:         http://cgit.haiku-os.org/haiku/commit/?id=ce39d3a
Author:      Adrien Destugues <pulkomandy@xxxxxxxxx>
Date:        Fri Jan  9 10:04:16 2015 UTC

Ticket:      https://dev.haiku-os.org/ticket/11721

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

1 file changed, 1 insertion(+), 3 deletions(-)
src/kits/interface/TextView.cpp | 4 +---

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

diff --git a/src/kits/interface/TextView.cpp b/src/kits/interface/TextView.cpp
index 5935830..b471092 100644
--- a/src/kits/interface/TextView.cpp
+++ b/src/kits/interface/TextView.cpp
@@ -2696,15 +2696,13 @@ BTextView::AllocRunArray(int32 entryCount, int32* 
outSize)
 {
        int32 size = sizeof(text_run_array) + (entryCount - 1) * 
sizeof(text_run);
 
-       text_run_array* runArray = (text_run_array*)malloc(size);
+       text_run_array* runArray = (text_run_array*)calloc(size, 1);
        if (runArray == NULL) {
                if (outSize != NULL)
                        *outSize = 0;
                return NULL;
        }
 
-       memset(runArray, 0, sizeof(size));
-
        runArray->count = entryCount;
 
        // Call constructors explicitly as the text_run_array


Other related posts:

  • » [haiku-commits] haiku: hrev48639 - src/kits/interface - pulkomandy