aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-01-05 20:57:25 +0800
committerJia Tan <jiat0218@gmail.com>2023-01-05 20:57:25 +0800
commit84f9687cbae972c2c342e10bf69f8ec8f70ae111 (patch)
treeef6ad2b9d1c399320bb25d676a7796514ff44bda /src
parentAdds test_index_hash to .gitignore. (diff)
downloadxz-84f9687cbae972c2c342e10bf69f8ec8f70ae111.tar.xz
liblzma: Remove common.h include from common/index.h.
common/index.h is needed by liblzma internally and tests. common.h will include and define many things that are not needed by the tests. Also, this prevents include order problems because common.h will redefine LZMA_API resulting in a warning.
Diffstat (limited to 'src')
-rw-r--r--src/liblzma/common/index.c1
-rw-r--r--src/liblzma/common/index.h9
-rw-r--r--src/liblzma/common/index_decoder.h1
-rw-r--r--src/liblzma/common/stream_buffer_encoder.c1
4 files changed, 10 insertions, 2 deletions
diff --git a/src/liblzma/common/index.c b/src/liblzma/common/index.c
index 24ec3c10..97cc9f95 100644
--- a/src/liblzma/common/index.c
+++ b/src/liblzma/common/index.c
@@ -10,6 +10,7 @@
//
///////////////////////////////////////////////////////////////////////////////
+#include "common.h"
#include "index.h"
#include "stream_flags_common.h"
diff --git a/src/liblzma/common/index.h b/src/liblzma/common/index.h
index ea396714..031efcc7 100644
--- a/src/liblzma/common/index.h
+++ b/src/liblzma/common/index.h
@@ -2,6 +2,13 @@
//
/// \file index.h
/// \brief Handling of Index
+/// \note This header file does not include common.h or lzma.h because
+/// this file is needed by both liblzma internally and by the
+/// tests. Including common.h will include and define many things
+/// the tests do not need and prevents issues with header file
+/// include order. This way, if lzma.h or common.h are not
+/// included before this file it will break on every OS instead
+/// of causing more subtle errors.
//
// Author: Lasse Collin
//
@@ -13,8 +20,6 @@
#ifndef LZMA_INDEX_H
#define LZMA_INDEX_H
-#include "common.h"
-
/// Minimum Unpadded Size
#define UNPADDED_SIZE_MIN LZMA_VLI_C(5)
diff --git a/src/liblzma/common/index_decoder.h b/src/liblzma/common/index_decoder.h
index 1af433b5..3fec4833 100644
--- a/src/liblzma/common/index_decoder.h
+++ b/src/liblzma/common/index_decoder.h
@@ -13,6 +13,7 @@
#ifndef LZMA_INDEX_DECODER_H
#define LZMA_INDEX_DECODER_H
+#include "common.h"
#include "index.h"
diff --git a/src/liblzma/common/stream_buffer_encoder.c b/src/liblzma/common/stream_buffer_encoder.c
index af49554a..73157590 100644
--- a/src/liblzma/common/stream_buffer_encoder.c
+++ b/src/liblzma/common/stream_buffer_encoder.c
@@ -10,6 +10,7 @@
//
///////////////////////////////////////////////////////////////////////////////
+#include "common.h"
#include "index.h"