iCyberon / pg_hashids

Short unique id generator for PostgreSQL, using hashids
MIT License
280 stars 24 forks source link

Fix mixed declarations and code issues #11

Closed rkgrep closed 6 years ago

rkgrep commented 6 years ago

Build fails on alpine linux due to ISO C90 standards:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c -o pg_hashids.o pg_hashids.c
pg_hashids.c: In function 'id_decode':
pg_hashids.c:154:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   unsigned long long *resultValues = (unsigned long long *)ARR_DATA_PTR(resultArray);
   ^~~~~~~~
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -fPIC -I. -I./ -I/usr/local/include/postgresql/server -I/usr/local/include/postgresql/internal -D_GNU_SOURCE -I/usr/include/libxml2   -c -o hashids.o hashids.c
hashids.c: In function 'hashids_encode':
hashids.c:425:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     size_t i, j, result_len, guard_index, half_length_ceil, half_length_floor;
     ^~~~~~
iCyberon commented 6 years ago

Thanks @rkgrep. Will merge and release v1.2.1