[hackers] [sselp] simplification || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Tue, 29 Jul 2008 18:03:00 +0000 (UTC)

changeset: 8:b1d7c6959f68
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Tue Jul 29 19:02:49 2008 +0100
files: sselp.c
description:
simplification

diff -r c0e40bd2afa1 -r b1d7c6959f68 sselp.c
--- a/sselp.c Sun Apr 20 19:07:08 2008 +0100
+++ b/sselp.c Tue Jul 29 19:02:49 2008 +0100
@@ -8,17 +8,6 @@
 #include <X11/Xutil.h>
 
 /* static */
-
-static void *
-emallocz(unsigned int size) {
- void *res = calloc(1, size);
-
- if(!res) {
- fprintf(stderr, "fatal: could not malloc() %u bytes\n", size);
- exit(EXIT_FAILURE);
- }
- return res;
-}
 
 static unsigned char *
 getselection(unsigned long offset, unsigned long *len, unsigned long *remain) {
@@ -47,7 +36,7 @@
                 XGetWindowProperty(dpy, w, ev.xselection.property, offset, 4096L, False,
                                 AnyPropertyType, &typeret, &format, len, remain, &data);
                 if(*len) {
- result = emallocz(sizeof(unsigned char) * *len);
+ result = malloc(sizeof(unsigned char) * *len);
                         memcpy(result, data, *len);
                 }
                 XDeleteProperty(dpy, w, ev.xselection.property);
Received on Tue Jul 29 2008 - 18:03:00 UTC

This archive was generated by hypermail 2.2.0 : Tue Jul 29 2008 - 18:12:05 UTC