| iMatix home page
| << | < | > | >>
SFL Logo SFL
Version 2.11

 

linebuf_create

#include "sfllbuf.h"
LINEBUF *
linebuf_create (size_t maxsize)

Synopsis

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).

Source Code - (sfllbuf.c)

{
    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);
}

| << | < | > | >> iMatix Copyright © 1996-2000 iMatix Corporation