diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-27 09:03:51 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-05-27 09:03:51 +0200 |
| commit | 7c934801f88c640970ad41b5ddd39f4e39609f28 (patch) | |
| tree | 76a065db76fbcbdec818b8b6cc8b108ac1c9eb49 /src/solvers/tables.h | |
| parent | 243a852d31483d10983c50978d1d4471efd0e553 (diff) | |
| download | nissy-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/solvers/tables.h')
| -rw-r--r-- | src/solvers/tables.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/solvers/tables.h b/src/solvers/tables.h index 53091f9..1e76fc1 100644 --- a/src/solvers/tables.h +++ b/src/solvers/tables.h | |||
| @@ -1,11 +1,13 @@ | |||
| 1 | STATIC uint64_t read_unaligned_u64(const unsigned char [static sizeof(uint64_t)]); | 1 | STATIC uint64_t read_unaligned_u64( |
| 2 | STATIC void write_unaligned_u64(unsigned char [static sizeof(uint64_t)], uint64_t); | 2 | const unsigned char [static sizeof(uint64_t)]); |
| 3 | STATIC void write_unaligned_u64( | ||
| 4 | unsigned char [static sizeof(uint64_t)], uint64_t); | ||
| 3 | STATIC int64_t readtableinfo( | 5 | STATIC int64_t readtableinfo( |
| 4 | size_t n, const unsigned char [n], tableinfo_t [static 1]); | 6 | size_t, const unsigned char *, tableinfo_t [static 1]); |
| 5 | STATIC int64_t readtableinfo_n( | 7 | STATIC int64_t readtableinfo_n( |
| 6 | size_t n, const unsigned char [n], uint8_t, tableinfo_t [static 1]); | 8 | size_t, const unsigned char *, uint8_t, tableinfo_t [static 1]); |
| 7 | STATIC int64_t writetableinfo( | 9 | STATIC int64_t writetableinfo( |
| 8 | const tableinfo_t [static 1], size_t n, unsigned char [n]); | 10 | const tableinfo_t [static 1], size_t, unsigned char *); |
| 9 | 11 | ||
| 10 | STATIC uint64_t | 12 | STATIC uint64_t |
| 11 | read_unaligned_u64(const unsigned char buf[static sizeof(uint64_t)]) | 13 | read_unaligned_u64(const unsigned char buf[static sizeof(uint64_t)]) |
| @@ -26,7 +28,7 @@ write_unaligned_u64(unsigned char buf[static sizeof(uint64_t)], uint64_t x) | |||
| 26 | STATIC int64_t | 28 | STATIC int64_t |
| 27 | readtableinfo( | 29 | readtableinfo( |
| 28 | size_t buf_size, | 30 | size_t buf_size, |
| 29 | const unsigned char buf[buf_size], | 31 | const unsigned char *buf, |
| 30 | tableinfo_t info[static 1] | 32 | tableinfo_t info[static 1] |
| 31 | ) | 33 | ) |
| 32 | { | 34 | { |
| @@ -70,7 +72,7 @@ readtableinfo( | |||
| 70 | STATIC int64_t | 72 | STATIC int64_t |
| 71 | readtableinfo_n( | 73 | readtableinfo_n( |
| 72 | size_t buf_size, | 74 | size_t buf_size, |
| 73 | const unsigned char buf[buf_size], | 75 | const unsigned char *buf, |
| 74 | uint8_t n, | 76 | uint8_t n, |
| 75 | tableinfo_t info[static 1] | 77 | tableinfo_t info[static 1] |
| 76 | ) | 78 | ) |
| @@ -88,7 +90,7 @@ STATIC int64_t | |||
| 88 | writetableinfo( | 90 | writetableinfo( |
| 89 | const tableinfo_t info[static 1], | 91 | const tableinfo_t info[static 1], |
| 90 | size_t data_size, | 92 | size_t data_size, |
| 91 | unsigned char buf[data_size] | 93 | unsigned char *buf |
| 92 | ) | 94 | ) |
| 93 | { | 95 | { |
| 94 | size_t i; | 96 | size_t i; |
