mirror of
https://github.com/labwc/labwc.git
synced 2025-11-02 09:01:47 -05:00
array: use die_if_null() from common/mem.c
This commit is contained in:
parent
a29bf5366f
commit
e9f17dc4a2
3 changed files with 10 additions and 7 deletions
|
|
@ -1,9 +1,9 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_ARRAY_H
|
||||
#define LABWC_ARRAY_H
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <wayland-server-core.h>
|
||||
#include "common/mem.h"
|
||||
|
||||
/*
|
||||
* Wayland's wl_array API is a bit sparse consisting only of
|
||||
|
|
@ -66,10 +66,7 @@ wl_array_len(struct wl_array *array)
|
|||
#define array_add(_arr, _val) do { \
|
||||
__typeof__(_val) *_entry = wl_array_add( \
|
||||
(_arr), sizeof(__typeof__(_val))); \
|
||||
if (!_entry) { \
|
||||
perror("Failed to allocate memory"); \
|
||||
exit(EXIT_FAILURE); \
|
||||
} \
|
||||
die_if_null(_entry); \
|
||||
*_entry = (_val); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue