diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ebrowse.c | 4 | ||||
| -rw-r--r-- | lib-src/etags.c | 3 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 3 | ||||
| -rw-r--r-- | lib-src/seccomp-filter.c | 3 |
4 files changed, 9 insertions, 4 deletions
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 3bb6bd88d79..93c0b52b950 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -19,6 +19,8 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> + +#include <stdcountof.h> #include <stddef.h> #include <stdlib.h> #include <string.h> @@ -3612,7 +3614,7 @@ static _Noreturn void usage (int error) { int i; - for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++) + for (i = 0; i < countof (usage_message); i++) fputs (usage_message[i], stdout); exit (error ? EXIT_FAILURE : EXIT_SUCCESS); } diff --git a/lib-src/etags.c b/lib-src/etags.c index 4114ba6b655..977484e4a67 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -110,6 +110,7 @@ University of California, as described above. */ #include <unistd.h> #include <stdarg.h> #include <stdckdint.h> +#include <stdcountof.h> #include <stdlib.h> #include <string.h> #include <sysstdio.h> @@ -6693,7 +6694,7 @@ mercury_decl (char *s, size_t pos) } else { - for (int j = 0; j < sizeof (Mercury_decl_tags) / sizeof (char*); ++j) + for (int j = 0; j < countof (Mercury_decl_tags); ++j) { if (memstreq (decl_type, decl_type_length, Mercury_decl_tags[j])) { diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index f6e321d876a..f13ade84244 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -37,6 +37,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ #include <config.h> #include <stdarg.h> +#include <stdcountof.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> @@ -651,7 +652,7 @@ compare_globals (const void *a, const void *b) /* Common symbols in decreasing popularity order. */ static char const commonsym[][8] = { "nil", "t", "unbound", "error", "lambda" }; - int ncommonsym = sizeof commonsym / sizeof *commonsym; + int ncommonsym = countof (commonsym); int ai = ncommonsym, bi = ncommonsym; for (int i = 0; i < ncommonsym; i++) { diff --git a/lib-src/seccomp-filter.c b/lib-src/seccomp-filter.c index a8cdc6e06f9..f58afbf272d 100644 --- a/lib-src/seccomp-filter.c +++ b/lib-src/seccomp-filter.c @@ -39,6 +39,7 @@ variants of those files that can be used to sandbox Emacs before #include <errno.h> #include <limits.h> #include <stdarg.h> +#include <stdcountof.h> #include <stdlib.h> #include <stdint.h> #include <stdio.h> @@ -119,7 +120,7 @@ set_attribute (enum scmp_filter_attr attr, uint32_t value) do \ { \ const struct scmp_arg_cmp arg_array[] = {__VA_ARGS__}; \ - enum { arg_cnt = sizeof arg_array / sizeof *arg_array }; \ + enum { arg_cnt = countof (arg_array) }; \ int status = seccomp_rule_add_array (ctx, action, syscall, \ arg_cnt, arg_array); \ if (status < 0) \ |
