summaryrefslogtreecommitdiff
path: root/manual/string.texi
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-02-10 16:37:51 +0000
committerUlrich Drepper <drepper@redhat.com>2001-02-10 16:37:51 +0000
commit87b56f36cc66554fdc2c435476a96a4f48789fea (patch)
tree53f09edf125262aa15a671ef2f04b7550895ba24 /manual/string.texi
parent51410f14533aadca209e3ac3775b16cac50613e5 (diff)
Update.
* sysdeps/unix/bsd/times.c: Reorder includes and add <time.h>. (timeval_to_clock_t): Add clk_tck argument and use that instead of CLK_TCK. (__times): Use __getclktck to get the number of clock ticks per second and use its return value instead of CLK_TCK. 2001-02-10 Mark Kettenis <kettenis@gnu.org>
Diffstat (limited to 'manual/string.texi')
-rw-r--r--manual/string.texi31
1 files changed, 30 insertions, 1 deletions
diff --git a/manual/string.texi b/manual/string.texi
index e3c15d1dad..745cb4a0ae 100644
--- a/manual/string.texi
+++ b/manual/string.texi
@@ -1066,6 +1066,35 @@ located byte, or a null pointer if no match was found.
@comment string.h
@comment GNU
+@deftypefun {void *} rawmemchr (const void *@var{block}, int @var{c})
+Often the @code{memchr} function is used with the knowledge that the
+byte @var{c} is available in the memory block specified by the
+parameters. But this means that the @var{size} parameter is not really
+needed and that the tests performed with it at runtime (to check whether
+the end of the block is reached) are not needed.
+
+The @code{rawmemchr} function exists for just this situation which is
+surprisingly frequent. The interface is similar to @code{memchr} except
+that the @var{size} parameter is missing. The function will look beyond
+the end of the block pointed to by @var{block} in case the programmer
+made in error in assuming that the byte @var{c} is present in the block.
+In this case the result is unspecified. Otherwise the return value is a
+pointer to the located byte.
+
+This function is of special interest when looking for the end of a
+string. Since all strings are terminated by a null byte a call like
+
+@smallexample
+ rawmemchr (str, '\0')
+@end smallexample
+
+will never go beyond the end of the string.
+
+This function is a GNU extension.
+@end deftypefun
+
+@comment string.h
+@comment GNU
@deftypefun {void *} memrchr (const void *@var{block}, int @var{c}, size_t @var{size})
The function @code{memrchr} is like @code{memchr}, except that it searches
backwards from the end of the block defined by @var{block} and @var{size}
@@ -1094,7 +1123,7 @@ specifying a null character as the value of the @var{c} argument.
@end deftypefun
@comment string.h
-@comment ???
+@comment GNU
@deftypefun {char *} strchrnul (const char *@var{string}, int @var{c})
@code{strchrnul} is the same as @code{strchr} except that if it does
not find the character, it returns a pointer to string's terminating