Re: [Autogen-users] 5.16.1 make check failure
Brought to you by:
bkorb
From: Bruce K. <bru...@gm...> - 2012-06-18 19:04:27
|
On 06/18/12 10:57, Dave Hart wrote: So curiosity got the better of me. Here is code from glibc: > /* Find the first occurrence of C in S. */ > char * > strchr (s, c_in) > const char *s; > int c_in; > { > const unsigned char *char_ptr; > const unsigned long int *longword_ptr; > unsigned long int longword, magic_bits, charmask; > unsigned reg_char c; > > c = (unsigned char) c_in; > > /* Handle the first few characters by reading one character at a time. > Do this until CHAR_PTR is aligned on a longword boundary. */ > for (char_ptr = (const unsigned char *) s; > ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0; > ++char_ptr) > if (*char_ptr == c) > return (void *) char_ptr; Please notice the last line. The cast is being used to strip the const-ness from "char_ptr". This is not really different from stripping it from the argument. |