|
| iMatix home page | << | < | > | >> |
SFLVersion 2.11 |
#include "sfllbuf.h" LINEBUF * linebuf_create (size_t maxsize)
Creates a new line buffer with the specified size. The size must be at least LINE_MAX + 1 characters long. Returns the address of the newly-created buffer, or NULL if there was insufficient memory. The fresh line buffer is set to empty (tail == head).
{
LINEBUF
*buffer;
ASSERT (maxsize > LINE_MAX);
buffer = mem_alloc (sizeof (LINEBUF));
if (!buffer)
return (NULL);
buffer-> data = mem_alloc (maxsize);
if (!buffer-> data)
{
free (buffer);
return (NULL);
}
buffer-> head = buffer-> data;
buffer-> tail = buffer-> data;
buffer-> top = buffer-> data + maxsize;
buffer-> size = maxsize;
return (buffer);
}
| | << | < | > | >> |
|