void *lcms_profile)
{
struct weston_color_profile *p;
- p = calloc(1, sizeof(struct weston_color_profile));
+ p = zalloc(sizeof(struct weston_color_profile));
p->filename = strdup(filename);
p->lcms_handle = lcms_profile;
return p;
if (fb)
return fb;
- fb = calloc(1, sizeof *fb);
- if (!fb)
+ fb = zalloc(sizeof *fb);
+ if (fb == NULL)
return NULL;
fb->bo = bo;
weston_log("Creating fbdev output.\n");
- output = calloc(1, sizeof *output);
- if (!output)
+ output = zalloc(sizeof *output);
+ if (output == NULL)
return -1;
output->compositor = compositor;
weston_log("initializing fbdev backend\n");
- compositor = calloc(1, sizeof *compositor);
+ compositor = zalloc(sizeof *compositor);
if (compositor == NULL)
return NULL;
int ret;
float mm_width, mm_height;
- output = calloc(1, sizeof *output);
- if (!output)
+ output = zalloc(sizeof *output);
+ if (output == NULL)
return -1;
output->compositor = compositor;
weston_log("initializing Raspberry Pi backend\n");
- compositor = calloc(1, sizeof *compositor);
+ compositor = zalloc(sizeof *compositor);
if (compositor == NULL)
return NULL;
{
struct weston_view *view;
- view = calloc(1, sizeof *view);
+ view = zalloc(sizeof *view);
if (view == NULL)
return NULL;
{
struct weston_surface *surface;
- surface = calloc(1, sizeof *surface);
+ surface = zalloc(sizeof *surface);
if (surface == NULL)
return NULL;
struct weston_subsurface *sub;
struct wl_client *client = wl_resource_get_client(surface->resource);
- sub = calloc(1, sizeof *sub);
- if (!sub)
+ sub = zalloc(sizeof *sub);
+ if (sub == NULL)
return NULL;
wl_list_init(&sub->unused_views);
{
struct weston_subsurface *sub;
- sub = calloc(1, sizeof *sub);
- if (!sub)
+ sub = zalloc(sizeof *sub);
+ if (sub == NULL)
return NULL;
weston_subsurface_link_surface(sub, parent);
surface = wl_resource_get_user_data(surface_resource);
- feedback = calloc(1, sizeof *feedback);
- if (!feedback)
+ feedback = zalloc(sizeof *feedback);
+ if (feedback == NULL)
goto err_calloc;
feedback->resource = wl_resource_create(client,
struct gl_surface_state *gs;
struct gl_renderer *gr = get_renderer(surface->compositor);
- gs = calloc(1, sizeof *gs);
- if (!gs)
+ gs = zalloc(sizeof *gs);
+ if (gs == NULL)
return -1;
/* A buffer is never attached to solid color surfaces, yet
return -1;
}
- go = calloc(1, sizeof *go);
-
- if (!go)
+ go = zalloc(sizeof *go);
+ if (go == NULL)
return -1;
go->egl_surface =
struct gl_renderer *gr;
EGLint major, minor;
- gr = calloc(1, sizeof *gr);
-
+ gr = zalloc(sizeof *gr);
if (gr == NULL)
return -1;
char *t;
int r;
- wl = calloc(1, sizeof(*wl));
- if (!wl) {
+ wl = zalloc(sizeof(*wl));
+ if (wl == NULL) {
r = -ENOMEM;
goto err_out;
}
struct pixman_surface_state *ps;
struct pixman_renderer *pr = get_renderer(surface->compositor);
- ps = calloc(1, sizeof *ps);
- if (!ps)
+ ps = zalloc(sizeof *ps);
+ if (ps == NULL)
return -1;
surface->renderer_state = ps;
{
struct pixman_renderer *renderer;
- renderer = calloc(1, sizeof *renderer);
+ renderer = zalloc(sizeof *renderer);
if (renderer == NULL)
return -1;
WL_EXPORT int
pixman_renderer_output_create(struct weston_output *output)
{
- struct pixman_output_state *po = calloc(1, sizeof *po);
+ struct pixman_output_state *po;
int w, h;
- if (!po)
+ po = zalloc(sizeof *po);
+ if (po == NULL)
return -1;
/* set shadow image transformation */
{
struct rpir_surface *surface;
- surface = calloc(1, sizeof *surface);
- if (!surface)
+ surface = zalloc(sizeof *surface);
+ if (surface == NULL)
return NULL;
wl_list_init(&surface->views);
{
struct rpir_view *view;
- view = calloc(1, sizeof *view);
- if (!view)
+ view = zalloc(sizeof *view);
+ if (view == NULL)
return NULL;
view->surface = surface;
surface->buffer_type = BUFFER_TYPE_EGL;
if(surface->egl_back == NULL)
- surface->egl_back = calloc(1, sizeof *surface->egl_back);
+ surface->egl_back = zalloc(sizeof *surface->egl_back);
weston_buffer_reference(&surface->egl_back->buffer_ref, buffer);
surface->egl_back->resource_handle =
weston_log("Initializing the DispmanX compositing renderer\n");
- renderer = calloc(1, sizeof *renderer);
+ renderer = zalloc(sizeof *renderer);
if (renderer == NULL)
return -1;
assert(base->renderer_state == NULL);
- output = calloc(1, sizeof *output);
- if (!output)
+ output = zalloc(sizeof *output);
+ if (output == NULL)
return -1;
output->display = display;
struct text_input_manager *text_input_manager = wl_resource_get_user_data(resource);
struct text_input *text_input;
- text_input = calloc(1, sizeof *text_input);
+ text_input = zalloc(sizeof *text_input);
+ if (text_input == NULL)
+ return;
text_input->resource =
wl_resource_create(client, &wl_text_input_interface, 1, id);
{
struct text_input_manager *text_input_manager;
- text_input_manager = calloc(1, sizeof *text_input_manager);
+ text_input_manager = zalloc(sizeof *text_input_manager);
+ if (text_input_manager == NULL)
+ return;
text_input_manager->ec = ec;
if (!input_method->input_method_binding)
return;
- context = calloc(1, sizeof *context);
+ context = zalloc(sizeof *context);
if (context == NULL)
return;
struct input_method *input_method;
struct weston_compositor *ec = seat->compositor;
- input_method = calloc(1, sizeof *input_method);
+ input_method = zalloc(sizeof *input_method);
+ if (input_method == NULL)
+ return;
input_method->seat = seat;
input_method->model = NULL;
{
struct text_backend *text_backend;
- text_backend = calloc(1, sizeof(*text_backend));
+ text_backend = zalloc(sizeof(*text_backend));
+ if (text_backend == NULL)
+ return -1;
text_backend->compositor = ec;
int major, minor;
int flags;
- r = calloc(1, sizeof *r);
- if (!r)
+ r = zalloc(sizeof *r);
+ if (r == NULL)
return NULL;
r->width = width;