This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] Faster strspn/strcspn implementation.


On Thu, 27 Dec 2012, OndÅ~Yej Bílka wrote:

> @@ -940,11 +943,11 @@ __stpcpy_small (char *__dest,
>  	 : ((__r0 = ((const char *) (reject))[0], __r0 == '\0')		      \
>  	    ? strlen (s)						      \
>  	    : ((__r1 = ((const char *) (reject))[1], __r1 == '\0')	      \
> -	       ? __strcspn_c1 (s, __r0)					      \
> +	       ? strchrnul (s,__r0) - s					      \

Although, strictly, strchrnul is in the implementation namespace (all 
str[a-z]* symbols are), it would be standard glibc practice to call a 
version __strchrnul here instead, rather than using the non-_-prefixed 
parts of implementation namespace.  (stpcpy is a POSIX.1-2008 function.)  
__strchrnul would in that case need to be assigned a public symbol version 
in string/Versions, with an appropriate comment explaining its use in 
public macros.

> -__STRING_INLINE size_t __strcspn_c1 (const char *__s, int __reject);
> -__STRING_INLINE size_t
> -__strcspn_c1 (const char *__s, int __reject)

These functions are part of the public ABI to glibc, version GLIBC_2.1.1, 
for existing binaries that use them because they used the macros but the 
compiler chose to use the out-of-line function.  string-inlines.c ensures 
appropriate exported versions are built into libc.so, and string/Versions 
lists these functions accordingly.  If the macros will no longer use them, 
you can make them compatibility symbols (not available for new links and 
not present for new architectures for which 2.18 or later is the earliest 
glibc version) but not remove them altogether; you need to arrange for 
them to continue to be exported from glibc.  Without that, I'd have 
expected the ABI tests to fail with your patch.

Similarly, the new inline functions you are adding need to be assigned 
versions for the out-of-line copies, via adding them to a new GLIBC_2.18 
section of string/Versions with an appropriate comment.  And the ABI test 
baselines will need updating for all architectures.

-- 
Joseph S. Myers
joseph@codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]