/* * Feynman -- Wayland compositor for GNU Emacs * * Copyright (c) 2022 Sameer Rahmani * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "queue.h" #include "utils.h" queue_t * init_queue (unsigned size) { event_t *data = (event_t *)malloc (sizeof (event_t) * size); queue_t *e = (queue_t *)malloc (sizeof (queue_t)); e->size = size; e->events = data; e->head = NULL; e->tail = NULL; return e; }; void deinit_queue (queue_t *q) { free (q->events); free (q); };