diff mbox

[libdrm,3/3] xf86drm: simplify drmMalloc/drmFree

Message ID 1430230199-3562-3-git-send-email-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Emil Velikov April 28, 2015, 2:09 p.m. UTC
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
---
 xf86drm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Alex Deucher April 28, 2015, 5:02 p.m. UTC | #1
On Tue, Apr 28, 2015 at 10:09 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>

For the series:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  xf86drm.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/xf86drm.c b/xf86drm.c
> index f7c45f8..9cd0b02 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -140,16 +140,12 @@ void *drmGetHashTable(void)
>
>  void *drmMalloc(int size)
>  {
> -    void *pt;
> -    if ((pt = malloc(size)))
> -       memset(pt, 0, size);
> -    return pt;
> +    return calloc(1, size);
>  }
>
>  void drmFree(void *pt)
>  {
> -    if (pt)
> -       free(pt);
> +    free(pt);
>  }
>
>  /**
> --
> 2.3.5
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Emil Velikov April 29, 2015, 2:24 p.m. UTC | #2
On 28 April 2015 at 18:02, Alex Deucher <alexdeucher@gmail.com> wrote:
> On Tue, Apr 28, 2015 at 10:09 AM, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
>
> For the series:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
>
Thank you. I'll give it another day or two before pushing (just in case).

-Emil
diff mbox

Patch

diff --git a/xf86drm.c b/xf86drm.c
index f7c45f8..9cd0b02 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -140,16 +140,12 @@  void *drmGetHashTable(void)
 
 void *drmMalloc(int size)
 {
-    void *pt;
-    if ((pt = malloc(size)))
-	memset(pt, 0, size);
-    return pt;
+    return calloc(1, size);
 }
 
 void drmFree(void *pt)
 {
-    if (pt)
-	free(pt);
+    free(pt);
 }
 
 /**