clients: Use zalloc
Signed-off-by: Bryce Harrington <bryce@osg.samsung.com>
This commit is contained in:
parent
cd9424ef2a
commit
0d1a622375
@ -46,6 +46,7 @@
|
||||
#include "shared/cairo-util.h"
|
||||
#include "shared/config-parser.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/zalloc.h"
|
||||
|
||||
#include "weston-desktop-shell-client-protocol.h"
|
||||
|
||||
@ -1203,7 +1204,7 @@ create_output(struct desktop *desktop, uint32_t id)
|
||||
{
|
||||
struct output *output;
|
||||
|
||||
output = calloc(1, sizeof *output);
|
||||
output = zalloc(sizeof *output);
|
||||
if (!output)
|
||||
return;
|
||||
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <wayland-client.h>
|
||||
#include "window.h"
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
#include "shared/zalloc.h"
|
||||
|
||||
struct fs_output {
|
||||
struct wl_list link;
|
||||
@ -460,7 +461,11 @@ output_handler(struct output *output, void *data)
|
||||
if (fsout->output == output)
|
||||
return;
|
||||
|
||||
fsout = calloc(1, sizeof *fsout);
|
||||
fsout = zalloc(sizeof *fsout);
|
||||
if (fsout == NULL) {
|
||||
fprintf(stderr, "out of memory in output_handler\n");
|
||||
return;
|
||||
}
|
||||
fsout->output = output;
|
||||
wl_list_insert(&fullscreen->output_list, &fsout->link);
|
||||
}
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "shared/config-parser.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "ivi-application-client-protocol.h"
|
||||
#include "ivi-hmi-controller-client-protocol.h"
|
||||
|
||||
@ -177,7 +178,7 @@ fail_on_null(void *p, size_t size, char *file, int32_t line)
|
||||
static void *
|
||||
mem_alloc(size_t size, char *file, int32_t line)
|
||||
{
|
||||
return fail_on_null(calloc(1, size), size, file, line);
|
||||
return fail_on_null(zalloc(size), size, file, line);
|
||||
}
|
||||
|
||||
#define MEM_ALLOC(s) mem_alloc((s),__FILE__,__LINE__)
|
||||
|
@ -40,6 +40,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/zalloc.h"
|
||||
|
||||
struct device {
|
||||
enum { KEYBOARD, POINTER } type;
|
||||
@ -87,7 +88,7 @@ xzalloc(size_t s)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = calloc(1, s);
|
||||
p = zalloc(s);
|
||||
if (p == NULL) {
|
||||
fprintf(stderr, "%s: out of memory\n", program_invocation_short_name);
|
||||
exit(EXIT_FAILURE);
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
@ -212,7 +213,7 @@ create_window(struct display *display, int width, int height,
|
||||
"presentation-shm: %s [Delay %i msecs]", run_mode_name[mode],
|
||||
commit_delay_msecs);
|
||||
|
||||
window = calloc(1, sizeof *window);
|
||||
window = zalloc(sizeof *window);
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
@ -500,7 +501,7 @@ window_create_feedback(struct window *window, uint32_t frame_stamp)
|
||||
if (!pres)
|
||||
return;
|
||||
|
||||
feedback = calloc(1, sizeof *feedback);
|
||||
feedback = zalloc(sizeof *feedback);
|
||||
if (!feedback)
|
||||
return;
|
||||
|
||||
@ -678,7 +679,7 @@ display_add_output(struct display *d, uint32_t name, uint32_t version)
|
||||
{
|
||||
struct output *o;
|
||||
|
||||
o = calloc(1, sizeof(*o));
|
||||
o = zalloc(sizeof(*o));
|
||||
assert(o);
|
||||
|
||||
o->output = wl_registry_bind(d->registry, name,
|
||||
|
@ -37,6 +37,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "xdg-shell-unstable-v5-client-protocol.h"
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
#include "scaler-client-protocol.h"
|
||||
@ -271,7 +272,7 @@ create_window(struct display *display, int width, int height,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
window = calloc(1, sizeof *window);
|
||||
window = zalloc(sizeof *window);
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <drm_fourcc.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/zalloc.h"
|
||||
#include "xdg-shell-unstable-v5-client-protocol.h"
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
@ -310,7 +311,7 @@ create_window(struct display *display, int width, int height)
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
window = calloc(1, sizeof *window);
|
||||
window = zalloc(sizeof *window);
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <linux/input.h>
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/zalloc.h"
|
||||
#include "xdg-shell-unstable-v5-client-protocol.h"
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
@ -544,7 +545,7 @@ create_window(struct display *display)
|
||||
{
|
||||
struct window *window;
|
||||
|
||||
window = calloc(1, sizeof *window);
|
||||
window = zalloc(sizeof *window);
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include <wayland-client.h>
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "xdg-shell-unstable-v5-client-protocol.h"
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
|
||||
@ -157,7 +158,7 @@ create_window(struct display *display, int width, int height)
|
||||
{
|
||||
struct window *window;
|
||||
|
||||
window = calloc(1, sizeof *window);
|
||||
window = zalloc(sizeof *window);
|
||||
if (!window)
|
||||
return NULL;
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "window.h"
|
||||
|
||||
#if 0
|
||||
@ -215,7 +216,7 @@ egl_state_create(struct wl_display *display)
|
||||
EGLint major, minor, n;
|
||||
EGLBoolean ret;
|
||||
|
||||
egl = calloc(1, sizeof *egl);
|
||||
egl = zalloc(sizeof *egl);
|
||||
assert(egl);
|
||||
|
||||
egl->dpy =
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "presentation-time-client-protocol.h"
|
||||
|
||||
typedef void (*print_info_t)(void *info);
|
||||
@ -138,7 +139,7 @@ xmalloc(size_t s)
|
||||
static void *
|
||||
xzalloc(size_t s)
|
||||
{
|
||||
return fail_on_null(calloc(1, s));
|
||||
return fail_on_null(zalloc(s));
|
||||
}
|
||||
|
||||
static char *
|
||||
|
@ -68,6 +68,7 @@ typedef void *EGLContext;
|
||||
#include <wayland-client.h>
|
||||
#include "shared/cairo-util.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/zalloc.h"
|
||||
#include "xdg-shell-unstable-v5-client-protocol.h"
|
||||
#include "text-cursor-position-client-protocol.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
@ -629,7 +630,7 @@ egl_window_surface_create(struct display *display,
|
||||
if (display->dpy == EGL_NO_DISPLAY)
|
||||
return NULL;
|
||||
|
||||
surface = calloc(1, sizeof *surface);
|
||||
surface = zalloc(sizeof *surface);
|
||||
if (!surface)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user