diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2023-05-11 23:42:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-11 23:42:43 +0200 |
| commit | 04d7728350cbd04dd86cd894e906c98673e3f9a7 (patch) | |
| tree | 08e8c7dd495d1c4c6fcf5f7ba6b4b10693dc42f6 /libpsn00b/lzp/compress.c | |
| parent | eaec942f56ceec9c14de5c4185a02602abadd50a (diff) | |
| parent | 58a8306d24fe29d965aa8b40ddc37c3163c0a2f9 (diff) | |
Merge pull request #70 from Lameguy64/v0.23-wip
Header cleanups, PCDRV, more safety checks, libc and mkpsxiso fixes (v0.23)
Diffstat (limited to 'libpsn00b/lzp/compress.c')
| -rw-r--r-- | libpsn00b/lzp/compress.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libpsn00b/lzp/compress.c b/libpsn00b/lzp/compress.c index 9cfc64d..16cb606 100644 --- a/libpsn00b/lzp/compress.c +++ b/libpsn00b/lzp/compress.c @@ -1,7 +1,7 @@ // Based on ilia muraviev's CRUSH compressor program which falls under public domain #include <string.h> -#if LZP_USE_MALLOC == TRUE +#ifdef LZP_USE_MALLOC #include <stdlib.h> #endif @@ -11,7 +11,7 @@ // Internal structure for hash table allocation sizes -#if LZP_NO_COMPRESS == FALSE +#ifndef LZP_NO_COMPRESS struct { short WindowSize; // Window size (17 - 23) @@ -67,7 +67,7 @@ struct { // LZ77 // -#if LZP_NO_COMPRESS == FALSE +#ifndef LZP_NO_COMPRESS int update_hash1(int h, int c) { @@ -108,13 +108,13 @@ int get_penalty(int a, int b) { int lzCompress(void* outBuff, const void* inBuff, int inSize, int level) { - #if LZP_USE_MALLOC == FALSE +#ifndef LZP_USE_MALLOC int head[HASH1_SIZE+HASH2_SIZE]; int prev[W_SIZE]; - #else +#else int* head = malloc(4*(HASH1_SIZE+HASH2_SIZE)); int* prev = malloc(4*W_SIZE); - #endif +#endif int max_chain[] = {4, 256, 1<<12}; @@ -319,10 +319,10 @@ int lzCompress(void* outBuff, const void* inBuff, int inSize, int level) { flush_bits(); - #if LZP_USE_MALLOC == TRUE +#ifdef LZP_USE_MALLOC free(head); free(prev); - #endif +#endif return(outBytes); |
