OSDN Git Service

minigbm: cros_gralloc: remove memsets
authorGurchetan Singh <gurchetansingh@chromium.org>
Mon, 20 Mar 2017 21:05:16 +0000 (14:05 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 31 Mar 2017 17:40:28 +0000 (10:40 -0700)
The C++ standard says value initialization results in
zero initialization for structs, so our memsets are
unecessary.

BUG=chromium:616275
TEST=compiles

Change-Id: I1744b237790cb79d2a8be92beffdb2ee9829f4e2
Reviewed-on: https://chromium-review.googlesource.com/457287
Commit-Ready: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
cros_gralloc/cros_alloc_device.cc

index 4ee1897..63b455c 100644 (file)
@@ -33,7 +33,6 @@ static struct cros_gralloc_bo *cros_gralloc_bo_create(struct driver *drv, int wi
        }
 
        bo = new cros_gralloc_bo();
-       memset(bo, 0, sizeof(*bo));
 
        bo->bo = drv_bo_create(drv, width, height, drv_format, drv_usage);
        if (!bo->bo) {
@@ -66,7 +65,6 @@ static struct cros_gralloc_handle *cros_gralloc_handle_from_bo(struct bo *bo)
        struct cros_gralloc_handle *hnd;
 
        hnd = new cros_gralloc_handle();
-       memset(hnd, 0, sizeof(*hnd));
 
        num_planes = drv_bo_get_num_planes(bo);
 
@@ -184,7 +182,6 @@ int cros_gralloc_open(const struct hw_module_t *mod, const char *name, struct hw
        }
 
        auto alloc = new alloc_device_t();
-       memset(alloc, 0, sizeof(*alloc));
 
        alloc->alloc = cros_gralloc_alloc;
        alloc->free = cros_gralloc_free;