aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2025-05-27 09:03:51 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2025-05-27 09:03:51 +0200
commit7c934801f88c640970ad41b5ddd39f4e39609f28 (patch)
tree76a065db76fbcbdec818b8b6cc8b108ac1c9eb49 /src/core
parent243a852d31483d10983c50978d1d4471efd0e553 (diff)
downloadnissy-core-7c934801f88c640970ad41b5ddd39f4e39609f28.tar.gz
nissy-core-7c934801f88c640970ad41b5ddd39f4e39609f28.zip
Removed VLA notation from function parameters.
I found out that this gives undefined behavior when then size is 0. Better not to have it at all, it is confusing for other developers anyway.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/moves.h24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/core/moves.h b/src/core/moves.h
index 5f48f8d..d3ff4a3 100644
--- a/src/core/moves.h
+++ b/src/core/moves.h
@@ -3,13 +3,13 @@
3 3
4STATIC uint8_t readmove(char); 4STATIC uint8_t readmove(char);
5STATIC int64_t readmoves(const char *, 5STATIC int64_t readmoves(const char *,
6 size_t n, size_t m, uint64_t *, uint64_t *, uint8_t [n], uint8_t [m]); 6 size_t, size_t, uint64_t *, uint64_t *, uint8_t *, uint8_t *);
7STATIC int64_t countmoves(const char *); 7STATIC int64_t countmoves(const char *);
8STATIC uint8_t readmodifier(char); 8STATIC uint8_t readmodifier(char);
9STATIC int64_t writemoves(size_t n, const uint8_t [n], size_t m, char [m]); 9STATIC int64_t writemoves(size_t, const uint8_t *, size_t, char *);
10 10
11STATIC_INLINE bool allowednextmove(uint8_t, uint8_t); 11STATIC_INLINE bool allowednextmove(uint8_t, uint8_t);
12STATIC bool allowedmoves(size_t n, const uint8_t [n]); 12STATIC bool allowedmoves(size_t, const uint8_t *);
13 13
14STATIC_INLINE uint8_t movebase(uint8_t); 14STATIC_INLINE uint8_t movebase(uint8_t);
15STATIC_INLINE uint8_t moveaxis(uint8_t); 15STATIC_INLINE uint8_t moveaxis(uint8_t);
@@ -24,8 +24,8 @@ STATIC uint8_t transform_move(uint8_t, uint8_t);
24STATIC cube_t move(cube_t, uint8_t); 24STATIC cube_t move(cube_t, uint8_t);
25STATIC cube_t premove(cube_t, uint8_t); 25STATIC cube_t premove(cube_t, uint8_t);
26STATIC uint8_t inverse_move(uint8_t); 26STATIC uint8_t inverse_move(uint8_t);
27STATIC void sortparallel_moves(size_t n, uint8_t [n]); 27STATIC void sortparallel_moves(size_t, uint8_t*);
28STATIC bool are_lastmoves_singlecw(size_t n, const uint8_t [n]); 28STATIC bool are_lastmoves_singlecw(size_t, const uint8_t*);
29 29
30#define FOREACH_READMOVE(ARG_BUF, ARG_MOVE, ARG_C, ARG_MAX, \ 30#define FOREACH_READMOVE(ARG_BUF, ARG_MOVE, ARG_C, ARG_MAX, \
31 RET_ERROR, ARG_ACTION) \ 31 RET_ERROR, ARG_ACTION) \
@@ -126,8 +126,8 @@ readmoves(
126 size_t invsize, 126 size_t invsize,
127 uint64_t *n, 127 uint64_t *n,
128 uint64_t *i, 128 uint64_t *i,
129 uint8_t normal[nsize], 129 uint8_t *normal,
130 uint8_t inverse[invsize] 130 uint8_t *inverse
131) 131)
132{ 132{
133 uint8_t m; 133 uint8_t m;
@@ -171,9 +171,9 @@ countmoves(const char *buf)
171STATIC int64_t 171STATIC int64_t
172writemoves( 172writemoves(
173 size_t nmoves, 173 size_t nmoves,
174 const uint8_t m[nmoves], 174 const uint8_t *m,
175 size_t buf_size, 175 size_t buf_size,
176 char buf[buf_size] 176 char *buf
177) 177)
178{ 178{
179 size_t i, len, w; 179 size_t i, len, w;
@@ -214,7 +214,7 @@ allowednextmove(uint8_t m1, uint8_t m2)
214} 214}
215 215
216STATIC bool 216STATIC bool
217allowedmoves(size_t n, const uint8_t m[n]) 217allowedmoves(size_t n, const uint8_t *m)
218{ 218{
219 uint8_t j; 219 uint8_t j;
220 220
@@ -422,7 +422,7 @@ inverse_move(uint8_t m)
422} 422}
423 423
424STATIC void 424STATIC void
425sortparallel_moves(size_t n, uint8_t moves[n]) 425sortparallel_moves(size_t n, uint8_t *moves)
426{ 426{
427 uint8_t i; 427 uint8_t i;
428 428
@@ -435,7 +435,7 @@ sortparallel_moves(size_t n, uint8_t moves[n])
435} 435}
436 436
437STATIC bool 437STATIC bool
438are_lastmoves_singlecw(size_t n, const uint8_t moves[n]) 438are_lastmoves_singlecw(size_t n, const uint8_t *moves)
439{ 439{
440 bool two; 440 bool two;
441 441

Generated with cgit - Back to sebastiano.tronto.net