summaryrefslogtreecommitdiff
path: root/modules/rawmemchr
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-08-20 19:25:06 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-08-20 19:25:56 -0700
commitb8ae80b252a4638c52c8f03bbf16b9c8d6bf27de (patch)
tree563639f83badc37b99924af9d1ea5595b7d340d6 /modules/rawmemchr
parenta38c80d8465dc8dfee5b32984a95833d2970c752 (diff)
downloadgnulib-b8ae80b252a4638c52c8f03bbf16b9c8d6bf27de.tar.gz
rawmemchr: modernize and simplify
* lib/rawmemchr.c (HAVE_RAWMEMCHR): Assume it’s not defined; otherwise this file would not be compiled. Include limits.h, stdalign.h, stdint.h, verify.h. (rawmemchr): Prefer uintptr_t to unsigned long and to size_t when it’s the better type. Verify that longword lacks padding. Use alignof rather than sizeof when checking alignment. Simplify by assuming C99 decl-after-statement, and by using multiplication rather than repeated shifting and OR (modern compilers can optimize the multiplication if needed). Avoid unnecessary casts. Don’t assume CHAR_WIDTH is 8. Convert back and forth between void * to suppress bogus GCC warnings about alignment. Omit a duplicate assignment to char_ptr. * modules/rawmemchr (Depends-on): Add stdalign, stdint, verify.
Diffstat (limited to 'modules/rawmemchr')
-rw-r--r--modules/rawmemchr3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/rawmemchr b/modules/rawmemchr
index 32320568c7..d30065e744 100644
--- a/modules/rawmemchr
+++ b/modules/rawmemchr
@@ -8,7 +8,10 @@ m4/rawmemchr.m4
Depends-on:
extensions
+stdalign
+stdint
string
+verify
configure.ac:
gl_FUNC_RAWMEMCHR