[PATCH] terminal: Convert all *alloc's to x*alloc's.

Michael Schellenberger Costa schellenberger at inb.uni-luebeck.de
Tue Apr 29 05:35:21 PDT 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

i might be dumb again, but as zalloc is a one line function, why not
just add the check to zalloc instead of searching for all uses of it?

Would there be any use case where one would not check for out of memory?

best wishes
Michael

 On 29.04.2014 14:16, Pekka Paalanen wrote:
> On Mon, 28 Apr 2014 18:44:08 +0000 "Bryce W. Harrington"
> <b.harrington at samsung.com> wrote:
> 
>> This ensures the allocation results are checked for NULL (out of 
>> memory), and terminates the program in such a case.
>> 
>> Signed-off-by: Bryce Harrington <b.harrington at samsung.com> --- 
>> clients/terminal.c |    6 +++--- 1 file changed, 3 insertions(+),
>> 3 deletions(-)
>> 
>> diff --git a/clients/terminal.c b/clients/terminal.c index
>> 5931ce2..924549e 100644 --- a/clients/terminal.c +++
>> b/clients/terminal.c @@ -772,10 +772,10 @@
>> terminal_resize_cells(struct terminal *terminal, } else { 
>> terminal->max_width = width; data_pitch = width * sizeof(union
>> utf8_char); -		data = zalloc(data_pitch *
>> terminal->buffer_height); +		data = xzalloc(data_pitch *
>> terminal->buffer_height); attr_pitch = width * sizeof(struct
>> attr); -		data_attr = malloc(attr_pitch *
>> terminal->buffer_height); -		tab_ruler = zalloc(width); +
>> data_attr = xmalloc(attr_pitch * terminal->buffer_height); +
>> tab_ruler = xzalloc(width); attr_init(data_attr,
>> terminal->curr_attr, width * terminal->buffer_height);
>> 
> 
> Seems fine to me.
> 
> Thanks, pq _______________________________________________ 
> wayland-devel mailing list wayland-devel at lists.freedesktop.org 
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJTX5yJAAoJECfkpCAi2eFKZFUH/2Ysnz0LUrgEHGecJcvDr7Ja
NkF4NU1ZZZ7RCP9Uy1KByojMyR5PaWTyOFkezgRDJbvzGJuOx8jzUFtVJyNlxBGf
9nQYL9K7vyjsWB5ZRz9Y4qXAVMv9kE44M0w3kg99hAsMKHhntOPCfXvoVElPA9jC
+TSbdmEkCkvtL9pLmGjIc/534395R0QV7M+nAqNtPZBEHWmUG92xZ3grc+NI0TIE
7j+f34XN9Ul5KPfwZtCuAEXH/fR+9Ux80vPbv+Y5kI3t4h0LbNsc/iZrj2D6VH4z
qV1GkpusxgdLfuepkKWOzqVlTAH84daDcI3eLKbhEdr2aWBiBcIB14Rgd8behLI=
=syQR
-----END PGP SIGNATURE-----


More information about the wayland-devel mailing list