comparison lib/mbsstr.c @ 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 d722bd5e44bd
children a0bbe1a6f787
comparison
equal deleted inserted replaced
9585:1487c59e896d 9586:f513e07afcaa
1 /* Searching in a string. 1 /* Searching in a string.
2 Copyright (C) 2005-2007 Free Software Foundation, Inc. 2 Copyright (C) 2005-2008 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2005. 3 Written by Bruno Haible <bruno@clisp.org>, 2005.
4 4
5 This program is free software: you can redistribute it and/or modify 5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or 7 the Free Software Foundation; either version 3 of the License, or
33 #include "str-kmp.h" 33 #include "str-kmp.h"
34 34
35 #if HAVE_MBRTOWC 35 #if HAVE_MBRTOWC
36 /* Knuth-Morris-Pratt algorithm. 36 /* Knuth-Morris-Pratt algorithm.
37 See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm 37 See http://en.wikipedia.org/wiki/Knuth-Morris-Pratt_algorithm
38 Return a boolean indicating success. */ 38 Return a boolean indicating success:
39 Return true and set *RESULTP if the search was completed.
40 Return false if it was aborted because not enough memory was available. */
39 static bool 41 static bool
40 knuth_morris_pratt_multibyte (const char *haystack, const char *needle, 42 knuth_morris_pratt_multibyte (const char *haystack, const char *needle,
41 const char **resultp) 43 const char **resultp)
42 { 44 {
43 size_t m = mbslen (needle); 45 size_t m = mbslen (needle);