/[imapfilter]/imapfilter/buffer.c
ViewVC logotype

Contents of /imapfilter/buffer.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2.2.1 - (show annotations)
Fri Aug 8 00:28:03 2003 UTC (20 years, 7 months ago) by lefcha
Branch: release-0_9-patches
Changes since 1.2: +1 -1 lines
File MIME type: text/plain
Corrected headers includes.

1 #include <stdio.h>
2
3 #include "config.h"
4 #include "imapfilter.h"
5 #include "buffer.h"
6
7
8 /*
9 * Initialize buffer.
10 */
11 void
12 init_buffer(buffer_t * buf)
13 {
14 buf->data = (char *)xmalloc(BUFFER_SIZE + 1);
15 *buf->data = '\0';
16 buf->size = BUFFER_SIZE + 1;
17 }
18
19
20 /*
21 * Reset buffer.
22 */
23 void
24 reset_buffer(buffer_t * buf)
25 {
26 *buf->data = '\0';
27 }
28
29
30 /*
31 * Check if the buffer has at enough space to store data and reallocate
32 * memory if needed.
33 */
34 void
35 check_buffer(buffer_t * buf, size_t n)
36 {
37 while (n >= buf->size) {
38 buf->size += BUFFER_SIZE;
39 buf->data = (char *)xrealloc(buf->data, buf->size);
40 }
41 }

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26