]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Use one strstr() call instead of chain of strcmp()
authorSergey Ponomarev <stokito@gmail.com>
Sat, 14 Sep 2019 18:26:27 +0000 (21:26 +0300)
committerSergey Ponomarev <stokito@gmail.com>
Sat, 14 Sep 2019 18:26:27 +0000 (21:26 +0300)
programs/fileio.c

index edf58fee6139de8f77bfc1d552476fe9dd438340..8816115b50692f4563b873018345d249d3637b00 100644 (file)
@@ -2193,18 +2193,7 @@ FIO_determineDstName(const char* srcFileName)
 
     /* check suffix is authorized */
     if (sfnSize <= suffixSize
-        || (   strcmp(suffixPtr, ZSTD_EXTENSION)
-        #ifdef ZSTD_GZDECOMPRESS
-            && strcmp(suffixPtr, GZ_EXTENSION)
-        #endif
-        #ifdef ZSTD_LZMADECOMPRESS
-            && strcmp(suffixPtr, XZ_EXTENSION)
-            && strcmp(suffixPtr, LZMA_EXTENSION)
-        #endif
-        #ifdef ZSTD_LZ4DECOMPRESS
-            && strcmp(suffixPtr, LZ4_EXTENSION)
-        #endif
-            ) ) {
+        || (strstr(SUFFIX_LIST, suffixPtr) == NULL)) {
         DISPLAYLEVEL(1, "zstd: %s: unknown suffix (%s expected). Can't derive the output file name so specify it with -o dstFileName. -- ignored \n",
                      srcFileName, SUFFIX_LIST);
         return NULL;