File deregister.patch of Package cdo
Author: Alastair McKinstry <mckinstry@debian.org>
Bugs-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=790393
Description: Remove 'register' from C code. Especially never try to get the
address of a register. Breaks HPPA code at least, and compilers do this
better in the 21st century.
diff -Nupr cdo-2.5.3.orig/libcdi/src/cdilib.c cdo-2.5.3/libcdi/src/cdilib.c
--- cdo-2.5.3.orig/libcdi/src/cdilib.c 2025-08-10 15:04:59.000000000 +0200
+++ cdo-2.5.3/libcdi/src/cdilib.c 2025-08-18 12:20:02.618020423 +0200
@@ -20867,7 +20867,7 @@ memcrc(const unsigned char *b, size_t n)
/* Extend with the length of the string. */
while (n != 0)
{
- register uint32_t c = n & 0377;
+ uint32_t c = n & 0377;
n >>= 8;
s = (s << 8) ^ crctab[(s >> 24) ^ c];
}
@@ -20883,9 +20883,9 @@ memcrc_r(uint32_t *state, const unsigned
* size_t n == length of sequence
*/
- register uint32_t c, s = *state;
- register size_t n = block_len;
- register const unsigned char *b = block;
+ uint32_t c, s = *state;
+ size_t n = block_len;
+ const unsigned char *b = block;
for (; n > 0; --n)
{
@@ -20899,7 +20899,7 @@ memcrc_r(uint32_t *state, const unsigned
#ifdef WORDS_BIGENDIAN
#define SWAP_CSUM(BITWIDTH, BYTEWIDTH, NACC) \
do { \
- register const uint##BITWIDTH##_t *b = (uint##BITWIDTH##_t *) elems; \
+ const uint##BITWIDTH##_t *b = (uint##BITWIDTH##_t *) elems; \
for (size_t i = 0; i < num_elems; ++i) \
{ \
for (size_t aofs = NACC; aofs > 0; --aofs) \
@@ -20927,7 +20927,7 @@ void
memcrc_r_eswap(uint32_t *state, const unsigned char *elems, size_t num_elems, size_t elem_size)
{
#ifdef WORDS_BIGENDIAN
- register uint32_t s = *state;
+ uint32_t s = *state;
switch (elem_size)
{
@@ -20946,8 +20946,8 @@ memcrc_r_eswap(uint32_t *state, const un
uint32_t
memcrc_finish(uint32_t *state, off_t total_size)
{
- register uint32_t c, s = *state;
- register uint64_t n = (uint64_t) total_size;
+ uint32_t c, s = *state;
+ uint64_t n = (uint64_t) total_size;
/* Extend with the length of the string. */
while (n != 0)
diff -Nupr cdo-2.5.3.orig/libcdi/src/cksum.c cdo-2.5.3/libcdi/src/cksum.c
--- cdo-2.5.3.orig/libcdi/src/cksum.c 2025-07-14 17:03:05.000000000 +0200
+++ cdo-2.5.3/libcdi/src/cksum.c 2025-08-18 12:20:55.730366087 +0200
@@ -54,7 +54,7 @@ memcrc(const unsigned char *b, size_t n)
/* Extend with the length of the string. */
while (n != 0)
{
- register uint32_t c = n & 0377;
+ uint32_t c = n & 0377;
n >>= 8;
s = (s << 8) ^ crctab[(s >> 24) ^ c];
}
@@ -70,9 +70,9 @@ memcrc_r(uint32_t *state, const unsigned
* size_t n == length of sequence
*/
- register uint32_t c, s = *state;
- register size_t n = block_len;
- register const unsigned char *b = block;
+ uint32_t c, s = *state;
+ size_t n = block_len;
+ const unsigned char *b = block;
for (; n > 0; --n)
{
@@ -86,7 +86,7 @@ memcrc_r(uint32_t *state, const unsigned
#ifdef WORDS_BIGENDIAN
#define SWAP_CSUM(BITWIDTH, BYTEWIDTH, NACC) \
do { \
- register const uint##BITWIDTH##_t *b = (uint##BITWIDTH##_t *) elems; \
+ const uint##BITWIDTH##_t *b = (uint##BITWIDTH##_t *) elems; \
for (size_t i = 0; i < num_elems; ++i) \
{ \
for (size_t aofs = NACC; aofs > 0; --aofs) \
@@ -114,7 +114,7 @@ void
memcrc_r_eswap(uint32_t *state, const unsigned char *elems, size_t num_elems, size_t elem_size)
{
#ifdef WORDS_BIGENDIAN
- register uint32_t s = *state;
+ uint32_t s = *state;
switch (elem_size)
{
@@ -133,8 +133,8 @@ memcrc_r_eswap(uint32_t *state, const un
uint32_t
memcrc_finish(uint32_t *state, off_t total_size)
{
- register uint32_t c, s = *state;
- register uint64_t n = (uint64_t) total_size;
+ uint32_t c, s = *state;
+ uint64_t n = (uint64_t) total_size;
/* Extend with the length of the string. */
while (n != 0)
diff -Nupr cdo-2.5.3.orig/src/lib/healpix/qsort_reentrant.c cdo-2.5.3/src/lib/healpix/qsort_reentrant.c
--- cdo-2.5.3.orig/src/lib/healpix/qsort_reentrant.c 2022-10-14 08:27:42.000000000 +0200
+++ cdo-2.5.3/src/lib/healpix/qsort_reentrant.c 2025-08-18 12:21:23.290545278 +0200
@@ -63,10 +63,10 @@ static __inline void swapfunc(char *
*/
#define swapcode(TYPE, parmi, parmj, n) { \
long i = (n) / sizeof (TYPE); \
- register TYPE *pi = (TYPE *) (parmi); \
- register TYPE *pj = (TYPE *) (parmj); \
+ TYPE *pi = (TYPE *) (parmi); \
+ TYPE *pj = (TYPE *) (parmj); \
do { \
- register TYPE t = *pi; \
+ TYPE t = *pi; \
*pi++ = *pj; \
*pj++ = t; \
} while (--i > 0); \