Skip to content

Commit

Permalink
build: Fix build with older gcc
Browse files Browse the repository at this point in the history
gcc 4.4.7 (hello RHEL 6) complains about redefinition of typedefs,
as in:

gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -DSYSCONFDIR='"/usr/local/etc"'  -g -O2  -g -O2 -MT nbd_client-buffer.o -MD -MP -MF .deps/nbd_client-buffer.Tpo -c -o nbd_client-buffer.o `test -f 'buffer.c' || echo './'`buffer.c
buffer.c:39: error: redefinition of typedef ‘buffer_t’
buffer.h:31: note: previous declaration of ‘buffer_t’ was here

The .c file only has to declare the struct being typedef'd, not
repeat the typedef declaration.

Signed-off-by: Eric Blake <[email protected]>
Signed-off-by: Wouter Verhelst <[email protected]>
  • Loading branch information
ebblake authored and yoe committed Feb 21, 2017
1 parent dce8c77 commit 180a5ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ OTHER DEALINGS IN THE SOFTWARE.

#include "buffer.h"

typedef struct buffer
struct buffer
{
char *buf;
ssize_t size;
ssize_t hwm;
ssize_t ridx;
ssize_t widx;
int empty;
} buffer_t;
};

/* the buffer is organised internally as follows:
*
Expand Down
4 changes: 2 additions & 2 deletions crypto-gnutls.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ OTHER DEALINGS IN THE SOFTWARE.

#define PRIORITY "NORMAL:-VERS-TLS-ALL:+VERS-TLS1.2"

typedef struct tlssession
struct tlssession
{
gnutls_certificate_credentials_t creds;
gnutls_session_t session;
Expand All @@ -62,7 +62,7 @@ typedef struct tlssession
int (*erroutfn) (void *opaque, const char *format, va_list ap);
int debug;
void *opaque;
} tlssession_t;
};

#define BUF_SIZE 65536
#define BUF_HWM ((BUF_SIZE*3)/4)
Expand Down

0 comments on commit 180a5ab

Please sign in to comment.