From 6bb0fecdc4511cf35ad7498262866c1dd506c21d Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 6 Nov 2022 11:04:52 +0100 Subject: [PATCH] Only define the contents of a struct minitar inside minitar This structure should be opaque for everyone using the library, and every public API just uses a pointer to it. --- Makefile | 2 +- minitar.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 584c692..c30a732 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ SRC := src CC ?= gcc AR ?= ar CFLAGS ?= -O2 -Wall -Wextra -CFLAGS := ${CFLAGS} -I. +CFLAGS := ${CFLAGS} -I. -D_IN_MINITAR DESTDIR ?= /usr/local OBJS := $(OBJ)/tar.o \ diff --git a/minitar.h b/minitar.h index be63f29..a99b3f4 100644 --- a/minitar.h +++ b/minitar.h @@ -3,10 +3,14 @@ #include #include +#ifdef _IN_MINITAR struct minitar { FILE* stream; }; +#else +struct minitar; +#endif enum minitar_file_type {