mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
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:

committed by
Simon Tatham

parent
5de69c22b0
commit
a2f7f962ce
4
misc.c
4
misc.c
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user