From d2b086b113f4bc1d7a247cd1ec4301211f87964d Mon Sep 17 00:00:00 2001 From: Nick Bowler Date: Sun, 27 Feb 2022 14:39:52 -0500 Subject: [PATCH] Use gnulib flexmember module. For increased portability to older C compilers. --- m4/.gitignore | 2 ++ m4/gnulib-cache.m4 | 4 ++++ src/engine/texture.gob | 2 +- src/uobject/vfs.c | 26 +++++++++++++------------- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/m4/.gitignore b/m4/.gitignore index 9454b32..f49561a 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -6,6 +6,7 @@ exponentf.m4 exponentl.m4 extensions.m4 extern-inline.m4 +flexmember.m4 float_h.m4 fpieee.m4 getopt.m4 @@ -13,6 +14,7 @@ gnulib-common.m4 gnulib-comp.m4 gnulib-tool.m4 include_next.m4 +inline.m4 isnand.m4 isnanf.m4 isnanl.m4 diff --git a/m4/gnulib-cache.m4 b/m4/gnulib-cache.m4 index 988fa8e..5a3ed85 100644 --- a/m4/gnulib-cache.m4 +++ b/m4/gnulib-cache.m4 @@ -40,7 +40,9 @@ # --macro-prefix=gl \ # --no-vc-files \ # copysignf \ +# flexmember \ # getopt-gnu \ +# inline \ # ldexpf \ # strcase @@ -48,7 +50,9 @@ gl_LOCAL_DIR([]) gl_MODULES([ copysignf + flexmember getopt-gnu + inline ldexpf strcase ]) diff --git a/src/engine/texture.gob b/src/engine/texture.gob index 165f48a..cc6b271 100644 --- a/src/engine/texture.gob +++ b/src/engine/texture.gob @@ -40,7 +40,7 @@ struct engine_texture_data { unsigned long width, height; unsigned long datalen; - unsigned char data[]; + unsigned char data[FLEXIBLE_ARRAY_MEMBER]; }; %} diff --git a/src/uobject/vfs.c b/src/uobject/vfs.c index 819dbc2..ac73ca4 100644 --- a/src/uobject/vfs.c +++ b/src/uobject/vfs.c @@ -1,19 +1,19 @@ /* - * Functions for handling UObject package search paths. - * Copyright © 2009-2011 Nick Bowler + * Functions for handling UObject package search paths. + * Copyright © 2009-2011, 2022 Nick Bowler * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . */ #include @@ -187,7 +187,7 @@ struct foreach_state { const char *name; struct upkg *f; size_t sz; - char buf[]; + char buf[FLEXIBLE_ARRAY_MEMBER]; }; static int foreachfile(const char *filename, void *_st) -- 2.43.2