Rename memswap() to swap_regions(). Consolidate duplicate implementations.

C99 reserves the mem* namespace for future expansion. Some Rockbox
targets had issues with memswap() conflicting with another definition,
so fix that.
This commit is contained in:
Franklin Wei
2024-07-21 18:33:01 -04:00
committed by Simon Tatham
parent 5de69c22b0
commit a2f7f962ce
4 changed files with 16 additions and 21 deletions

4
misc.c
View File

@ -294,7 +294,7 @@ void game_mkhighlight(frontend *fe, float *ret,
game_mkhighlight_specific(fe, ret, background, highlight, lowlight);
}
static void memswap(void *av, void *bv, int size)
void swap_regions(void *av, void *bv, size_t size)
{
char tmpbuf[512];
char *a = av, *b = bv;
@ -318,7 +318,7 @@ void shuffle(void *array, int nelts, int eltsize, random_state *rs)
for (i = nelts; i-- > 1 ;) {
int j = random_upto(rs, i+1);
if (j != i)
memswap(carray + eltsize * i, carray + eltsize * j, eltsize);
swap_regions(carray + eltsize * i, carray + eltsize * j, eltsize);
}
}