aboutsummaryrefslogtreecommitdiff
path: root/src/liblzma/lz
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2022-07-25 18:30:05 +0300
committerLasse Collin <lasse.collin@tukaani.org>2022-07-25 18:30:10 +0300
commit61f8ec804abdb4c5dac01e8ae9b90c7be58a5c24 (patch)
tree40d0d4fea71bfeffe9a7fbb72e9667e7f0ccbf83 /src/liblzma/lz
parentBuild: Don't allow empty LIST in --enable-match-finders=LIST. (diff)
downloadxz-61f8ec804abdb4c5dac01e8ae9b90c7be58a5c24.tar.xz
liblzma: Refactor lzma_mf_is_supported() to use a switch-statement.
Diffstat (limited to 'src/liblzma/lz')
-rw-r--r--src/liblzma/lz/lz_encoder.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/src/liblzma/lz/lz_encoder.c b/src/liblzma/lz/lz_encoder.c
index 08a8afe3..890d1bc4 100644
--- a/src/liblzma/lz/lz_encoder.c
+++ b/src/liblzma/lz/lz_encoder.c
@@ -601,32 +601,28 @@ lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
extern LZMA_API(lzma_bool)
lzma_mf_is_supported(lzma_match_finder mf)
{
- bool ret = false;
-
+ switch (mf) {
#ifdef HAVE_MF_HC3
- if (mf == LZMA_MF_HC3)
- ret = true;
+ case LZMA_MF_HC3:
+ return true;
#endif
-
#ifdef HAVE_MF_HC4
- if (mf == LZMA_MF_HC4)
- ret = true;
+ case LZMA_MF_HC4:
+ return true;
#endif
-
#ifdef HAVE_MF_BT2
- if (mf == LZMA_MF_BT2)
- ret = true;
+ case LZMA_MF_BT2:
+ return true;
#endif
-
#ifdef HAVE_MF_BT3
- if (mf == LZMA_MF_BT3)
- ret = true;
+ case LZMA_MF_BT3:
+ return true;
#endif
-
#ifdef HAVE_MF_BT4
- if (mf == LZMA_MF_BT4)
- ret = true;
+ case LZMA_MF_BT4:
+ return true;
#endif
-
- return ret;
+ default:
+ return false;
+ }
}