Skip to content

Commit 0816f4c

Browse files
committed
Add ifdef to avoid redefinition
1 parent b7986ff commit 0816f4c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/Memory.hpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,19 @@ limitations under the License.
2222

2323
// Likely / unlikely macros
2424
#if defined(__GNUC__) || defined(__clang__)
25-
#define LIKELY(x) __builtin_expect(!!(x), 1)
26-
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
25+
#ifndef LIKELY
26+
#define LIKELY(x) __builtin_expect(!!(x), 1)
27+
#endif
28+
#ifndef UNLIKELY
29+
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
30+
#endif
2731
#else
28-
#define LIKELY(x) (x)
29-
#define UNLIKELY(x) (x)
32+
#ifndef LIKELY
33+
#define LIKELY(x) (x)
34+
#endif
35+
#ifndef UNLIKELY
36+
#define UNLIKELY(x) (x)
37+
#endif
3038
#endif
3139

3240
namespace kanzi {

src/app/BlockDecompressor.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,6 @@ T FileDecompressTask<T>::run()
627627
}
628628

629629
Clock stopClock;
630-
static const int DEFAULT_BUFFER_SIZE = 65536;
631630
byte* buf = new byte[DEFAULT_BUFFER_SIZE];
632631

633632
try {

src/app/BlockDecompressor.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ namespace kanzi {
9191
template <class T>
9292
class FileDecompressTask FINAL : public Task<T> {
9393
public:
94+
static const int DEFAULT_BUFFER_SIZE = 65536;
95+
9496
FileDecompressTask(const Context& ctx, std::vector<Listener<Event>*>& listeners);
9597

9698
~FileDecompressTask();

0 commit comments

Comments
 (0)