Added the working_* fields as a scratch pad for readline().

This commit is contained in:
Robert James Kaes 2000-03-31 20:09:19 +00:00
parent 0edeabbd63
commit ae347fc87a
2 changed files with 11 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $Id: buffer.c,v 1.1.1.1 2000-02-16 17:32:22 sdyoung Exp $ /* $Id: buffer.c,v 1.2 2000-03-31 20:09:19 rjkaes Exp $
* *
* The buffer used in each connection is a linked list of lines. As the lines * The buffer used in each connection is a linked list of lines. As the lines
* are read in and written out the buffer expands and contracts. Basically, * are read in and written out the buffer expands and contracts. Basically,
@ -72,6 +72,9 @@ struct buffer_s *new_buffer(void)
buffptr->head = buffptr->tail = NULL; buffptr->head = buffptr->tail = NULL;
buffptr->size = 0; buffptr->size = 0;
buffptr->working_string = NULL;
buffptr->working_length = 0;
return buffptr; return buffptr;
} }
@ -92,6 +95,9 @@ void delete_buffer(struct buffer_s *buffptr)
buffer_head(buffptr) = NULL; buffer_head(buffptr) = NULL;
buffer_tail(buffptr) = NULL; buffer_tail(buffptr) = NULL;
buffptr->working_length = 0;
safefree(buffptr->working_string);
safefree(buffptr); safefree(buffptr);
} }

View File

@ -1,4 +1,4 @@
/* $Id: buffer.h,v 1.1.1.1 2000-02-16 17:32:22 sdyoung Exp $ /* $Id: buffer.h,v 1.2 2000-03-31 20:09:19 rjkaes Exp $
* *
* See 'buffer.c' for a detailed description. * See 'buffer.c' for a detailed description.
* *
@ -31,6 +31,9 @@ struct buffer_s {
struct bufline_s *head; /* top of the buffer */ struct bufline_s *head; /* top of the buffer */
struct bufline_s *tail; /* bottom of the buffer */ struct bufline_s *tail; /* bottom of the buffer */
unsigned long int size; /* total size of the buffer */ unsigned long int size; /* total size of the buffer */
unsigned char *working_string; /* needed for building a new line incr. */
unsigned int working_length; /* length of working line */
}; };
#define buffer_head(x) (((struct buffer_s *)(x))->head) #define buffer_head(x) (((struct buffer_s *)(x))->head)