+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Circular buffer implementation.
* Copyright (C) 2017 Cumulus Networks
* Quentin Young
- *
- * 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; either version 2 of the License, or (at your option)
- * any later version.
- *
- * 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; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <zebra.h>
#include "ringbuf.h"
#include "memory.h"
-DEFINE_MTYPE_STATIC(LIB, RINGBUFFER, "Ring buffer")
+DEFINE_MTYPE_STATIC(LIB, RINGBUFFER, "Ring buffer");
struct ringbuf *ringbuf_new(size_t size)
{
size_t remain = ringbuf_remain(buf);
if (offset >= remain)
return 0;
- size_t copysize = MAX(MIN(remain - offset, size), (size_t) 0);
+ size_t copysize = MAX(MIN(remain - offset, size), (size_t)0);
size_t tocopy = copysize;
size_t cstart = (buf->start + offset) % buf->size;
if (tocopy >= buf->size - cstart) {