This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove usage of ZSTD_CLEVEL_DEFAULT define.


Hi.

As Martin Jambor noticed, a zstd ZSTD_CLEVEL_DEFAULT macro is not
defined in a bit older releases of zstd. However, one can use 0
as a default compression level.

Ready to be installed after regression tests & bootstrap?
Thanks,
Martin

gcc/ChangeLog:

2019-07-08  Martin Liska  <mliska@suse.cz>

	* lto-compress.c (lto_normalized_zstd_level): Do not use
	ZSTD_CLEVEL_DEFAULT as it is not default in old releases
	of libzstd.  One can use 0 as a default compression level.
---
 gcc/lto-compress.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)


diff --git a/gcc/lto-compress.c b/gcc/lto-compress.c
index b925363ac71..c5c37dbcbfc 100644
--- a/gcc/lto-compress.c
+++ b/gcc/lto-compress.c
@@ -115,13 +115,10 @@ lto_normalized_zstd_level (void)
 {
   int level = flag_lto_compression_level;
 
-  if (level != ZSTD_CLEVEL_DEFAULT)
-    {
-      if (level < 1)
-	level = 1;
-      else if (level > ZSTD_maxCLevel ())
-	level = ZSTD_maxCLevel ();
-    }
+  if (level < 0)
+    level = 0;
+  else if (level > ZSTD_maxCLevel ())
+    level = ZSTD_maxCLevel ();
 
   return level;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]