14 |
|
|
15 |
/* Code for the buffer data structure. */ |
/* Code for the buffer data structure. */ |
16 |
|
|
17 |
#include "cvs.h" |
#ifdef HAVE_CONFIG_H |
18 |
|
# include <config.h> |
19 |
|
#endif |
20 |
|
|
21 |
#include "buffer.h" |
#include "buffer.h" |
22 |
|
|
23 |
|
#include "cvs.h" |
24 |
#include "pagealign_alloc.h" |
#include "pagealign_alloc.h" |
25 |
|
|
26 |
#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) |
#if defined (SERVER_SUPPORT) || defined (CLIENT_SUPPORT) |
956 |
int |
int |
957 |
buf_read_data (struct buffer *buf, size_t want, char **retdata, size_t *got) |
buf_read_data (struct buffer *buf, size_t want, char **retdata, size_t *got) |
958 |
{ |
{ |
|
assert (buf->input != NULL); |
|
|
|
|
959 |
while (buf->data != NULL && buf->data->size == 0) |
while (buf->data != NULL && buf->data->size == 0) |
960 |
{ |
{ |
961 |
struct buffer_data *next; |
struct buffer_data *next; |
973 |
int status; |
int status; |
974 |
size_t get, nbytes; |
size_t get, nbytes; |
975 |
|
|
976 |
|
if (!buf->input) |
977 |
|
/* nonio (memory) buffers have no underlying input methods. If |
978 |
|
* there are no buffer datas, just return EOF. |
979 |
|
*/ |
980 |
|
return -1; |
981 |
|
|
982 |
data = get_buffer_data (); |
data = get_buffer_data (); |
983 |
if (data == NULL) |
if (data == NULL) |
984 |
{ |
{ |