From c06eabac8e85f7f79414363836f093415e8da62e Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Sun, 9 Aug 2015 10:52:34 +0200 Subject: common/iobuf.h: Replace further use of literals with symbolic constants. * common/iobuf.c: Move BLOCK_FILTER_INPUT, BLOCK_FILTER_OUTPUT_BLOCK_FILTER_TEMP from here... * common/iobuf.h: ... to here and rename to IOBUF_INPUT, IOBUF_OUTPUT and IOBUF_TEMP, respectively. Where appropriate, use these macros instead of a literal. -- Signed-off-by: Neal H. Walfield . --- common/iobuf.h | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'common/iobuf.h') diff --git a/common/iobuf.h b/common/iobuf.h index 3889459e3..23b1d091e 100644 --- a/common/iobuf.h +++ b/common/iobuf.h @@ -55,6 +55,13 @@ typedef enum IOBUF_IOCTL_FSYNC = 4 /* Uses ptrval. */ } iobuf_ioctl_t; +enum + { + IOBUF_INPUT=1, + IOBUF_OUTPUT=2, + IOBUF_TEMP=3 + }; + typedef struct iobuf_struct *iobuf_t; typedef struct iobuf_struct *IOBUF; /* Compatibility with gpg 1.4. */ @@ -62,7 +69,9 @@ typedef struct iobuf_struct *IOBUF; /* Compatibility with gpg 1.4. */ /* fixme: we should hide most of this stuff */ struct iobuf_struct { - int use; /* 1 input , 2 output, 3 temp */ + /* The type of filter. Either IOBUF_INPUT, IOBUF_OUTPUT or + IOBUF_TEMP. */ + int use; off_t nlimit; off_t nbytes; /* Used together with nlimit. */ off_t ntotal; /* Total bytes read (position of stream). */ @@ -184,6 +193,8 @@ void iobuf_skip_rest (iobuf_t a, unsigned long n, int partial); #define iobuf_get_temp_buffer(a) ( (a)->d.buf ) #define iobuf_get_temp_length(a) ( (a)->d.len ) -#define iobuf_is_temp(a) ( (a)->use == 3 ) + +/* Whether the filter uses an in-memory buffer. */ +#define iobuf_is_temp(a) ( (a)->use == IOBUF_TEMP ) #endif /*GNUPG_COMMON_IOBUF_H*/ -- cgit v1.2.3