Skip to content

Commit a7c2ccd

Browse files
committed
FIX: include only included optional compressions in system/catalog/compressions
1 parent d32f60d commit a7c2ccd

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

src/boot/sysobj.reb

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ catalog: object [
107107
quoted-printable: #[bitset! #{FFFFFFFFFFFFFFFBFFFFFFFFFFFFFFFF}]
108108
]
109109
checksums: [adler32 crc24 crc32 tcp md4 md5 sha1 sha224 sha256 sha384 sha512 ripemd160]
110-
compressions: [gzip deflate zlib lzma crush brotli]
110+
compressions: [deflate zlib gzip] ;; these are always available
111111
elliptic-curves: [
112112
; will be filled on boot from `Init_Crypt` in `n-crypt.c`
113113
]

src/core/b-init.c

+28
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,33 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
995995
Current_Year = dat.year;
996996
}
997997

998+
/***********************************************************************
999+
**
1000+
*/ void Init_Compression(void)
1001+
/*
1002+
** Fill system/catalog/compressions with optional compressions
1003+
**
1004+
***********************************************************************/
1005+
{
1006+
REBVAL *blk;
1007+
REBVAL tmp;
1008+
#define add_compression(sym) Init_Word(&tmp, sym); VAL_SET_LINE(&tmp); Append_Val(VAL_SERIES(blk), &tmp);
1009+
blk = Get_System(SYS_CATALOG, CAT_COMPRESSIONS);
1010+
if (blk && IS_BLOCK(blk)) {
1011+
#ifdef INCLUDE_BROTLI
1012+
add_compression(SYM_BROTLI);
1013+
#endif
1014+
#ifdef INCLUDE_CRUSH
1015+
add_compression(SYM_CRUSH);
1016+
#endif
1017+
#ifdef INCLUDE_LZMA
1018+
add_compression(SYM_LZMA);
1019+
#endif
1020+
}
1021+
}
1022+
1023+
1024+
9981025

9991026
/***********************************************************************
10001027
**
@@ -1081,6 +1108,7 @@ static void Set_Option_File(REBCNT field, REBYTE* src, REBOOL dir )
10811108
PG_Boot_Phase = BOOT_ERRORS;
10821109

10831110
Init_Year();
1111+
Init_Compression();
10841112

10851113
// Special pre-made error:
10861114
ser = Make_Error(RE_STACK_OVERFLOW, 0, 0, 0);

0 commit comments

Comments
 (0)