diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-25 18:35:47 +0100 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-03-25 18:35:47 +0100 |
| commit | 56048d13b73ec6e6a9c59d62e82f41e69a3994bd (patch) | |
| tree | 49fc5d50e739a399897425756c08a73ba5924ddb /src/arch/portable.h | |
| parent | 0f4931c8de298b0f97aba1757c9538f48adb30c6 (diff) | |
| download | nissy-core-56048d13b73ec6e6a9c59d62e82f41e69a3994bd.tar.gz nissy-core-56048d13b73ec6e6a9c59d62e82f41e69a3994bd.zip | |
More safety with pointers using VLA function parameters
Diffstat (limited to '')
| -rw-r--r-- | src/arch/portable.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/arch/portable.h b/src/arch/portable.h index b8c5211..4ac5fe7 100644 --- a/src/arch/portable.h +++ b/src/arch/portable.h | |||
| @@ -22,7 +22,7 @@ popcount_u32(uint32_t x) | |||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | STATIC void | 24 | STATIC void |
| 25 | pieces(cube_t *cube, uint8_t c[static 8], uint8_t e[static 12]) | 25 | pieces(cube_t cube[static 1], uint8_t c[static 8], uint8_t e[static 12]) |
| 26 | { | 26 | { |
| 27 | memcpy(c, cube->corner, 8); | 27 | memcpy(c, cube->corner, 8); |
| 28 | memcpy(e, cube->edge, 12); | 28 | memcpy(e, cube->edge, 12); |
| @@ -227,19 +227,19 @@ coord_esep(cube_t c) | |||
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | STATIC_INLINE void | 229 | STATIC_INLINE void |
| 230 | copy_corners(cube_t *dest, cube_t src) | 230 | copy_corners(cube_t dest[static 1], cube_t src) |
| 231 | { | 231 | { |
| 232 | memcpy(&dest->corner, src.corner, sizeof(src.corner)); | 232 | memcpy(&dest->corner, src.corner, sizeof(src.corner)); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | STATIC_INLINE void | 235 | STATIC_INLINE void |
| 236 | copy_edges(cube_t *dest, cube_t src) | 236 | copy_edges(cube_t dest[static 1], cube_t src) |
| 237 | { | 237 | { |
| 238 | memcpy(&dest->edge, src.edge, sizeof(src.edge)); | 238 | memcpy(&dest->edge, src.edge, sizeof(src.edge)); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | STATIC_INLINE void | 241 | STATIC_INLINE void |
| 242 | set_eo(cube_t *cube, int64_t eo) | 242 | set_eo(cube_t cube[static 1], int64_t eo) |
| 243 | { | 243 | { |
| 244 | uint8_t i, sum, flip; | 244 | uint8_t i, sum, flip; |
| 245 | 245 | ||
