From 7c934801f88c640970ad41b5ddd39f4e39609f28 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Tue, 27 May 2025 09:03:51 +0200 Subject: 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. --- src/solvers/tables.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/solvers/tables.h') 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 @@ -STATIC uint64_t read_unaligned_u64(const unsigned char [static sizeof(uint64_t)]); -STATIC void write_unaligned_u64(unsigned char [static sizeof(uint64_t)], uint64_t); +STATIC uint64_t read_unaligned_u64( + const unsigned char [static sizeof(uint64_t)]); +STATIC void write_unaligned_u64( + unsigned char [static sizeof(uint64_t)], uint64_t); STATIC int64_t readtableinfo( - size_t n, const unsigned char [n], tableinfo_t [static 1]); + size_t, const unsigned char *, tableinfo_t [static 1]); STATIC int64_t readtableinfo_n( - size_t n, const unsigned char [n], uint8_t, tableinfo_t [static 1]); + size_t, const unsigned char *, uint8_t, tableinfo_t [static 1]); STATIC int64_t writetableinfo( - const tableinfo_t [static 1], size_t n, unsigned char [n]); + const tableinfo_t [static 1], size_t, unsigned char *); STATIC uint64_t 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) STATIC int64_t readtableinfo( size_t buf_size, - const unsigned char buf[buf_size], + const unsigned char *buf, tableinfo_t info[static 1] ) { @@ -70,7 +72,7 @@ readtableinfo( STATIC int64_t readtableinfo_n( size_t buf_size, - const unsigned char buf[buf_size], + const unsigned char *buf, uint8_t n, tableinfo_t info[static 1] ) @@ -88,7 +90,7 @@ STATIC int64_t writetableinfo( const tableinfo_t info[static 1], size_t data_size, - unsigned char buf[data_size] + unsigned char *buf ) { size_t i; -- cgit v1.3