Skip to content

Commit 6668f8a

Browse files
committed
Use multiline command syntax where appropriate
1 parent a46faa4 commit 6668f8a

File tree

4 files changed

+84
-79
lines changed

4 files changed

+84
-79
lines changed

src/isal/_isalmodule.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
// Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2-
// 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
3-
// Python Software Foundation; All Rights Reserved
4-
5-
// This file is part of python-isal which is distributed under the
6-
// PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
7-
8-
// This file is not originally from the CPython distribution. But it does
9-
// contain mostly example code from the Python docs. Also dual licensing just
10-
// for this one file seemed silly.
1+
/*
2+
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
4+
Python Software Foundation; All Rights Reserved
5+
6+
This file is part of python-isal which is distributed under the
7+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
8+
9+
This file is not originally from the CPython distribution. But it does
10+
contain mostly example code from the Python docs. Also dual licensing just
11+
for this one file seemed silly.
12+
*/
1113

1214
#define PY_SSIZE_T_CLEAN
1315
#include <Python.h>

src/isal/igzip_libmodule.c

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
// Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2-
// 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
3-
// Python Software Foundation; All Rights Reserved
4-
5-
// This file is part of python-isal which is distributed under the
6-
// PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
7-
8-
// This file was modified from Cpython Modules/bz2module.c file from the 3.9
9-
// branch.
10-
11-
// Changes compared to CPython:
12-
// - The BZ2Decompressor has been used as a basis for IgzipDecompressor.
13-
// Functionality is almost the same. IgzipDecompressor does have a more
14-
// elaborate __init__ to set settings. It also implements decompress_buf more
15-
// akin to how decompression is implemented in isal_shared.h
16-
// - Constants were added that are particular to igzip_lib.
17-
// - Argument parsers were written using th CPython API rather than argument
18-
// clinic.
1+
/*
2+
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
4+
Python Software Foundation; All Rights Reserved
5+
6+
This file is part of python-isal which is distributed under the
7+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
8+
9+
This file was modified from Cpython Modules/bz2module.c file from the 3.9
10+
branch.
11+
12+
Changes compared to CPython:
13+
- The BZ2Decompressor has been used as a basis for IgzipDecompressor.
14+
Functionality is almost the same. IgzipDecompressor does have a more
15+
elaborate __init__ to set settings. It also implements decompress_buf more
16+
akin to how decompression is implemented in isal_shared.h
17+
- Constants were added that are particular to igzip_lib.
18+
- Argument parsers were written using th CPython API rather than argument
19+
clinic.
20+
*/
1921

2022
#include "isal_shared.h"
2123

@@ -62,16 +64,16 @@ decompress_buf(IgzipDecompressor *self, Py_ssize_t max_length)
6264

6365
int err;
6466

65-
// In Python 3.10 sometimes sys.maxsize is passed by default. In those cases
66-
// we do want to use DEF_BUF_SIZE as start buffer.
67+
/* In Python 3.10 sometimes sys.maxsize is passed by default. In those cases
68+
we do want to use DEF_BUF_SIZE as start buffer. */
6769
if ((max_length < 0) || max_length == PY_SSIZE_T_MAX) {
6870
hard_limit = PY_SSIZE_T_MAX;
6971
obuflen = DEF_BUF_SIZE;
7072
} else {
71-
// Assume that decompressor is used in file decompression with a fixed
72-
// block size of max_length. In that case we will reach max_length almost
73-
// always (except at the end of the file). So it makes sense to allocate
74-
// max_length.
73+
/* Assume that decompressor is used in file decompression with a fixed
74+
block size of max_length. In that case we will reach max_length almost
75+
always (except at the end of the file). So it makes sense to allocate
76+
max_length. */
7577
hard_limit = max_length;
7678
obuflen = max_length;
7779
if (obuflen > DEF_MAX_INITIAL_BUF_SIZE){

src/isal/isal_shared.h

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
// Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2-
// 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
3-
// Python Software Foundation; All Rights Reserved
4-
5-
// This file is part of python-isal which is distributed under the
6-
// PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
7-
8-
// This file was modified from Cpython Modules/zlibmodule.c file from the 3.9
9-
// branch. This is because the BlocksBuffer used in Python 3.10 and higher is
10-
// not available in python 3.7-3.9 which this project supports.
11-
12-
// Changes compared to CPython:
13-
// - igzip_lib.compress and igzip_lib.decompress are equivalent to
14-
// zlib.compress and zlib.decompress except that these use a 'flag' and
15-
// 'hist_bits' argument to set compression headers and trailers and window
16-
// size respectively. The igzip_lib functions also offer more control by
17-
// allowing to set no header, but include the trailer.
18-
// - This file also includes some utility functions to set parameters on ISA-L
19-
// structs.
20-
1+
/*
2+
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
4+
Python Software Foundation; All Rights Reserved
5+
6+
This file is part of python-isal which is distributed under the
7+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
8+
9+
This file was modified from Cpython Modules/zlibmodule.c file from the 3.9
10+
branch. This is because the BlocksBuffer used in Python 3.10 and higher is
11+
not available in python 3.7-3.9 which this project supports.
12+
13+
Changes compared to CPython:
14+
- igzip_lib.compress and igzip_lib.decompress are equivalent to
15+
zlib.compress and zlib.decompress except that these use a 'flag' and
16+
'hist_bits' argument to set compression headers and trailers and window
17+
size respectively. The igzip_lib functions also offer more control by
18+
allowing to set no header, but include the trailer.
19+
- This file also includes some utility functions to set parameters on ISA-L
20+
structs.
21+
*/
2122
#define PY_SSIZE_T_CLEAN
2223
#include <Python.h>
2324
#include "structmember.h" // PyMemberDef

src/isal/isal_zlibmodule.c

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
// Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2-
// 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
3-
// Python Software Foundation; All Rights Reserved
4-
5-
// This file is part of python-isal which is distributed under the
6-
// PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
7-
8-
// This file was modified from Cpython's Modules/zlibmodule.c file.
9-
// Changes compared to CPython:
10-
// - All zlib naming changed to isal_zlib
11-
// - Including a few constants that are more specific to the ISA-L library
12-
// (ISAL_DEFAULT_COMPRESSION etc).
13-
// - Zlib to ISA-L conversion functions were included.
14-
// - All compression and checksum functions from zlib replaced with ISA-L
15-
// compatible functions.
16-
// - No locks in Compress and Decompress objects. These were deemed unnecessary
17-
// as the ISA-L functions do not allocate memory, unlike the zlib
18-
// counterparts.
19-
// - zlib.compress also has a 'wbits' argument. This change was included in
20-
// Python 3.11. It allows for faster gzip compression by using
21-
// isal_zlib.compress(data, wbits=31).
22-
// - Argument parsers were written using th CPython API rather than argument
23-
// clinic.
24-
1+
/*
2+
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
3+
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022
4+
Python Software Foundation; All Rights Reserved
5+
6+
This file is part of python-isal which is distributed under the
7+
PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2.
8+
9+
This file was modified from Cpython's Modules/zlibmodule.c file.
10+
Changes compared to CPython:
11+
- All zlib naming changed to isal_zlib
12+
- Including a few constants that are more specific to the ISA-L library
13+
(ISAL_DEFAULT_COMPRESSION etc).
14+
- Zlib to ISA-L conversion functions were included.
15+
- All compression and checksum functions from zlib replaced with ISA-L
16+
compatible functions.
17+
- No locks in Compress and Decompress objects. These were deemed unnecessary
18+
as the ISA-L functions do not allocate memory, unlike the zlib
19+
counterparts.
20+
- zlib.compress also has a 'wbits' argument. This change was included in
21+
Python 3.11. It allows for faster gzip compression by using
22+
isal_zlib.compress(data, wbits=31).
23+
- Argument parsers were written using th CPython API rather than argument
24+
clinic.
25+
*/
2526

2627
#include "isal_shared.h"
2728

@@ -1241,7 +1242,6 @@ PyInit_isal_zlib(void)
12411242
PyModule_AddIntConstant(m, "DEFLATED", Z_DEFLATED);
12421243
PyModule_AddIntMacro(m, DEF_MEM_LEVEL);
12431244
PyModule_AddIntMacro(m, DEF_BUF_SIZE);
1244-
// compression levels
12451245
// No compression is not supported by ISA-L. Throw an error if chosen.
12461246
// PyModule_AddIntMacro(m, Z_NO_COMPRESSION);
12471247
PyModule_AddIntConstant(m, "Z_BEST_SPEED", ISAL_DEF_MIN_LEVEL);

0 commit comments

Comments
 (0)