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

Annotation of /imapfilter/buffer.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations)
Fri Feb 13 12:17:15 2004 UTC (20 years, 2 months ago) by lefcha
Branch: MAIN
Changes since 1.4: +3 -3 lines
File MIME type: text/plain
Stylistic changes.

1 lefcha 1.3 #include <stdio.h>
2 lefcha 1.1
3 lefcha 1.2 #include "config.h"
4 lefcha 1.1 #include "imapfilter.h"
5 lefcha 1.2 #include "buffer.h"
6 lefcha 1.1
7    
8     /*
9     * Initialize buffer.
10     */
11     void
12 lefcha 1.5 buffer_init(buffer_t * buf)
13 lefcha 1.1 {
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 lefcha 1.5 buffer_reset(buffer_t * buf)
25 lefcha 1.1 {
26     *buf->data = '\0';
27     }
28    
29    
30     /*
31 lefcha 1.4 * Check if the buffer has enough space to store data and reallocate memory if
32     * needed.
33 lefcha 1.1 */
34     void
35 lefcha 1.5 buffer_check(buffer_t * buf, size_t n)
36 lefcha 1.1 {
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