@@ -66,7 +66,7 @@ typedef struct binascii_state {
66
66
PyObject * Incomplete ;
67
67
} binascii_state ;
68
68
69
- static binascii_state *
69
+ static inline binascii_state *
70
70
get_binascii_state (PyObject * module )
71
71
{
72
72
return (binascii_state * )PyModule_GetState (module );
@@ -312,7 +312,7 @@ binascii_a2b_uu_impl(PyObject *module, Py_buffer *data)
312
312
** '`' as zero instead of space.
313
313
*/
314
314
if ( this_ch < ' ' || this_ch > (' ' + 64 )) {
315
- state = PyModule_GetState (module );
315
+ state = get_binascii_state (module );
316
316
if (state == NULL ) {
317
317
return NULL ;
318
318
}
@@ -344,7 +344,7 @@ binascii_a2b_uu_impl(PyObject *module, Py_buffer *data)
344
344
/* Extra '`' may be written as padding in some cases */
345
345
if ( this_ch != ' ' && this_ch != ' ' + 64 &&
346
346
this_ch != '\n' && this_ch != '\r' ) {
347
- state = PyModule_GetState (module );
347
+ state = get_binascii_state (module );
348
348
if (state == NULL ) {
349
349
return NULL ;
350
350
}
@@ -385,7 +385,7 @@ binascii_b2a_uu_impl(PyObject *module, Py_buffer *data, int backtick)
385
385
bin_len = data -> len ;
386
386
if ( bin_len > 45 ) {
387
387
/* The 45 is a limit that appears in all uuencode's */
388
- state = PyModule_GetState (module );
388
+ state = get_binascii_state (module );
389
389
if (state == NULL ) {
390
390
return NULL ;
391
391
}
@@ -505,9 +505,9 @@ binascii_a2b_base64_impl(PyObject *module, Py_buffer *data)
505
505
}
506
506
507
507
if (quad_pos != 0 ) {
508
- binascii_state * state = PyModule_GetState (module );
508
+ binascii_state * state = get_binascii_state (module );
509
509
if (state == NULL ) {
510
- /* error already set, from PyModule_GetState */
510
+ /* error already set, from get_binascii_state */
511
511
} else if (quad_pos == 1 ) {
512
512
/*
513
513
** There is exactly one extra valid, non-padding, base64 character.
@@ -562,7 +562,7 @@ binascii_b2a_base64_impl(PyObject *module, Py_buffer *data, int newline)
562
562
assert (bin_len >= 0 );
563
563
564
564
if ( bin_len > BASE64_MAXBIN ) {
565
- state = PyModule_GetState (module );
565
+ state = get_binascii_state (module );
566
566
if (state == NULL ) {
567
567
return NULL ;
568
568
}
@@ -657,7 +657,7 @@ binascii_a2b_hqx_impl(PyObject *module, Py_buffer *data)
657
657
if ( this_ch == SKIP )
658
658
continue ;
659
659
if ( this_ch == FAIL ) {
660
- state = PyModule_GetState (module );
660
+ state = get_binascii_state (module );
661
661
if (state == NULL ) {
662
662
return NULL ;
663
663
}
@@ -682,7 +682,7 @@ binascii_a2b_hqx_impl(PyObject *module, Py_buffer *data)
682
682
}
683
683
684
684
if ( leftbits && !done ) {
685
- state = PyModule_GetState (module );
685
+ state = get_binascii_state (module );
686
686
if (state == NULL ) {
687
687
return NULL ;
688
688
}
@@ -878,7 +878,7 @@ binascii_rledecode_hqx_impl(PyObject *module, Py_buffer *data)
878
878
#define INBYTE (b ) \
879
879
do { \
880
880
if ( --in_len < 0 ) { \
881
- state = PyModule_GetState (module); \
881
+ state = get_binascii_state (module); \
882
882
if (state == NULL) { \
883
883
return NULL; \
884
884
} \
@@ -904,7 +904,7 @@ binascii_rledecode_hqx_impl(PyObject *module, Py_buffer *data)
904
904
/* Note Error, not Incomplete (which is at the end
905
905
** of the string only). This is a programmer error.
906
906
*/
907
- state = PyModule_GetState (module );
907
+ state = get_binascii_state (module );
908
908
if (state == NULL ) {
909
909
return NULL ;
910
910
}
@@ -1235,7 +1235,7 @@ binascii_a2b_hex_impl(PyObject *module, Py_buffer *hexstr)
1235
1235
* raise an exception.
1236
1236
*/
1237
1237
if (arglen % 2 ) {
1238
- state = PyModule_GetState (module );
1238
+ state = get_binascii_state (module );
1239
1239
if (state == NULL ) {
1240
1240
return NULL ;
1241
1241
}
@@ -1252,7 +1252,7 @@ binascii_a2b_hex_impl(PyObject *module, Py_buffer *hexstr)
1252
1252
unsigned int top = _PyLong_DigitValue [Py_CHARMASK (argbuf [i ])];
1253
1253
unsigned int bot = _PyLong_DigitValue [Py_CHARMASK (argbuf [i + 1 ])];
1254
1254
if (top >= 16 || bot >= 16 ) {
1255
- state = PyModule_GetState (module );
1255
+ state = get_binascii_state (module );
1256
1256
if (state == NULL ) {
1257
1257
return NULL ;
1258
1258
}
0 commit comments