Use g_malloc0 where appropriate; remove unneeded null check
This commit is contained in:
parent
656846900a
commit
8ba62dc78a
@ -131,10 +131,7 @@ static void on_notify(GDBusConnection * connection,
|
|||||||
gchar *icon = NULL;
|
gchar *icon = NULL;
|
||||||
gchar *summary = NULL;
|
gchar *summary = NULL;
|
||||||
gchar *body = NULL;
|
gchar *body = NULL;
|
||||||
Actions *actions = g_malloc(sizeof(Actions));
|
Actions *actions = g_malloc0(sizeof(Actions));
|
||||||
if(actions == NULL) {
|
|
||||||
die("Unable to allocate memory", EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
gint timeout = -1;
|
gint timeout = -1;
|
||||||
|
|
||||||
/* hints */
|
/* hints */
|
||||||
@ -145,10 +142,6 @@ static void on_notify(GDBusConnection * connection,
|
|||||||
gchar *category = NULL;
|
gchar *category = NULL;
|
||||||
RawImage *raw_icon = NULL;
|
RawImage *raw_icon = NULL;
|
||||||
|
|
||||||
actions->actions = NULL;
|
|
||||||
actions->count = 0;
|
|
||||||
actions->dmenu_str = NULL;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
GVariantIter *iter = g_variant_iter_new(parameters);
|
GVariantIter *iter = g_variant_iter_new(parameters);
|
||||||
GVariant *content;
|
GVariant *content;
|
||||||
|
@ -323,10 +323,7 @@ char *notification_extract_markup_urls(char **str_ptr) {
|
|||||||
*/
|
*/
|
||||||
notification *notification_create(void)
|
notification *notification_create(void)
|
||||||
{
|
{
|
||||||
notification *n = g_malloc(sizeof(notification));
|
return g_malloc0(sizeof(notification));
|
||||||
if(n == NULL) die("Unable to allocate memory", EXIT_FAILURE);
|
|
||||||
memset(n, 0, sizeof(notification));
|
|
||||||
return n;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void notification_init_defaults(notification *n)
|
void notification_init_defaults(notification *n)
|
||||||
|
3
src/x.c
3
src/x.c
@ -385,9 +385,6 @@ static GdkPixbuf *get_pixbuf_from_raw_image(const RawImage *raw_image)
|
|||||||
static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
static colored_layout *r_init_shared(cairo_t *c, notification *n)
|
||||||
{
|
{
|
||||||
colored_layout *cl = g_malloc(sizeof(colored_layout));
|
colored_layout *cl = g_malloc(sizeof(colored_layout));
|
||||||
if(cl == NULL) {
|
|
||||||
die("Unable to allocate memory", EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
cl->l = pango_cairo_create_layout(c);
|
cl->l = pango_cairo_create_layout(c);
|
||||||
|
|
||||||
if (!settings.word_wrap) {
|
if (!settings.word_wrap) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user