changeset 9586:f513e07afcaa

Document the knuth_morris_pratt calling convention better.
author Bruno Haible <bruno@clisp.org>
date Tue, 08 Jan 2008 23:54:30 +0100
parents 1487c59e896d
children 263f472dc864
files ChangeLog lib/mbscasestr.c lib/mbsstr.c lib/str-kmp.h
diffstat 4 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-01-08  Bruno Haible  <bruno@clisp.org>
+
+	* lib/str-kmp.h (knuth_morris_pratt_unibyte): Document the calling
+	convention better.
+	* lib/mbsstr.c (knuth_morris_pratt_multibyte): Likewise.
+	* lib/mbscasestr.c (knuth_morris_pratt_multibyte): Likewise.
+	Reported by Peter Miller <millerp@canb.auug.org.au>.
+
 2008-01-08  Bruno Haible  <bruno@clisp.org>
 
 	* m4/wcwidth.m4 (gl_FUNC_WCWIDTH): Test also U+3000. Needed to
--- a/lib/mbscasestr.c
+++ b/lib/mbscasestr.c
@@ -1,5 +1,5 @@
 /* Case-insensitive searching in a string.
-   Copyright (C) 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2005-2008 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2005.
 
    This program is free software: you can redistribute it and/or modify
@@ -38,7 +38,9 @@
 #if HAVE_MBRTOWC
 /* Knuth-Morris-Pratt algorithm.
    See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
-   Return a boolean indicating success.  */
+   Return a boolean indicating success:
+   Return true and set *RESULTP if the search was completed.
+   Return false if it was aborted because not enough memory was available.  */
 static bool
 knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
 			      const char **resultp)
--- a/lib/mbsstr.c
+++ b/lib/mbsstr.c
@@ -1,5 +1,5 @@
 /* Searching in a string.
-   Copyright (C) 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2005-2008 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2005.
 
    This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,9 @@
 #if HAVE_MBRTOWC
 /* Knuth-Morris-Pratt algorithm.
    See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
-   Return a boolean indicating success.  */
+   Return a boolean indicating success:
+   Return true and set *RESULTP if the search was completed.
+   Return false if it was aborted because not enough memory was available.  */
 static bool
 knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
 			      const char **resultp)
--- a/lib/str-kmp.h
+++ b/lib/str-kmp.h
@@ -1,6 +1,6 @@
 /* Substring search in a NUL terminated string of 'char' elements,
    using the Knuth-Morris-Pratt algorithm.
-   Copyright (C) 2005-2007 Free Software Foundation, Inc.
+   Copyright (C) 2005-2008 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2005.
 
    This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,9 @@
 
 /* Knuth-Morris-Pratt algorithm.
    See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
-   Return a boolean indicating success.  */
+   Return a boolean indicating success:
+   Return true and set *RESULTP if the search was completed.
+   Return false if it was aborted because not enough memory was available.  */
 static bool
 knuth_morris_pratt_unibyte (const char *haystack, const char *needle,
 			    const char **resultp)