/* This file is part of limb https://lila.oss/limb
* Copyright (C) 2023 Olivier Brunel jjk@jjacky.com */
/* SPDX-License-Identifier: GPL-2.0-only */
#include <errno.h>
#include <limb/obuffer.h>
int
obuffer_detach(obuffer *b)
{
if (!b->n) return (errno = EINVAL, 0);
obuffer *l;
for (l = b; l->n != b; l = l->n)
;
l->n = b->n;
b->n = NULL;
return 1;
}