Re: [PATCH] test : Maintain consistency in the usage of xcalloc

RAVI NANJUNDAPPA <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <31858976.33671399887761050.JavaMail.weblogic@epml09>
Hello All, 

Can someone please look into this patch and provide your views/comments on the proposed patch ?

Thanks and Best Regards, 
N Ravi

------- Original Message -------
Sender : RAVI NANJUNDAPPA<[email protected]> Technical Lead/SRI-Bangalore-TZN/Samsung Electronics
Date : May 06, 2014 16:47 (GMT+05:30)
Title : Re: [cairo] [PATCH] test : Maintain consistency in the usage of xcalloc

Yes. I've tried in my Ubuntu Linux machine. It works fine here. 
AFAIK, xcalloc is just a wrapper on calloc and is defined in boilerplate/cairo-boilerplate-system.c, which is also built during 'make'.
So I feel there shouldn't be any problem in other platforms as well.

Moreover, there is already a test case (./test/user-font-rescale.c) in current git repo, which is using xcalloc 
and is free from any build related issues.

Please share with me if you are finding any differences in your environment so that I can re-work and submit the patch back, if necessary.

Thanks and Best Regards, 
N Ravi

From: Petr KobalĂ­?ek [mailto:[email protected]] 
Sent: Tuesday, May 06, 2014 4:06 PM
To: RAVI NANJUNDAPPA
Cc: [email protected]
Subject: Re: [cairo] [PATCH] test : Maintain consistency in the usage of xcalloc

Will this compile everywhere?


Best regards
Petr Kobalicek

On Tue, May 6, 2014 at 12:25 PM, RAVI NANJUNDAPPA wrote:
Hi,

Kindly ignore the previous mail. That was sent in the HTML format, by
mistake.
Sorry for the inconvenience caused.

I've done the basic build test with the changes and the build works fine.
I've also tried to execute "negative-stride-image" and "stride-12-image"
tests with and without these changes.
In both the scenarios the test results are same.

Thanks and Best Regards,
N Ravi
From: cairo [mailto:[email protected]] On Behalf Of RAVI
NANJUNDAPPA
Sent: Tuesday, May 06, 2014 3:52 PM
To: [email protected]
Subject: Re: [cairo] [PATCH] test : Maintain consistency in the usage of
xcalloc

Hi,

I've done the basic build test with the changes and the build works fine.
I've also tried to execute "negative-stride-image" and "stride-12-image"
tests with and without these changes.
In both the scenarios the results are same.

Thanks and Best Regards,
N Ravi

------- Original Message -------
Sender : RAVI NANJUNDAPPA Technical
Lead/SRI-Bangalore-TZN/Samsung Electronics
Date : May 06, 2014 15:44 (GMT+05:30)
Title : [PATCH] test : Maintain consistency in the usage of xcalloc

xcalloc is a wrapper for calloc. If it can't allocate memory then it
terminates the program. The current changes replace the usages of calloc
by xcalloc in tests.

Signed-off-by: Ravi Nanjundappa
---
test/negative-stride-image.c |    2 +-
test/stride-12-image.c       |    2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/negative-stride-image.c b/test/negative-stride-image.c
index a407b8c..dfc8d64 100644
--- a/test/negative-stride-image.c
+++ b/test/negative-stride-image.c
@@ -41,7 +41,7 @@ draw (cairo_t *cr, int width, int height)
     png = cairo_test_create_surface_from_png (ctx, png_filename);

     stride = cairo_format_stride_for_width (format, width);
-    data = calloc (stride, height);
+    data = xcalloc (stride, height);
     inv = cairo_image_surface_create_for_data (data + stride * (height -
1),
       format, width, height, -stride);

diff --git a/test/stride-12-image.c b/test/stride-12-image.c
index 21bd8b0..5650e98 100644
--- a/test/stride-12-image.c
+++ b/test/stride-12-image.c
@@ -41,7 +41,7 @@ draw (cairo_t *cr, int width, int height)
     png = cairo_test_create_surface_from_png (ctx, png_filename);

     stride = cairo_format_stride_for_width (format, width) + 12;
-    data = calloc (stride, height);
+    data = xcalloc (stride, height);
     src = cairo_image_surface_create_for_data (data, format,
       width, height, stride);

--
1.7.9.5



--
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo


-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.