[PATCH] octstr_search_chars broken

Guillaume Cottenceau <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

Here's a patch that allows octstr_search_chars to not ignore its
`pos' parameter.

Additionally, it performs octstr_search-similar checks and now
fits more along the lines of doc/CodingStyle.


-- 
Guillaume Cottenceau
octstr-octstr_search_chars.diff (text/x-patch, 771 B)
Index: gwlib/octstr.c
===================================================================
RCS file: /home/cvs/gateway/gwlib/octstr.c,v
retrieving revision 1.159
diff -u -r1.159 octstr.c
--- gwlib/octstr.c	8 Mar 2004 23:09:42 -0000	1.159
+++ gwlib/octstr.c	19 Apr 2004 11:28:11 -0000
@@ -958,11 +958,17 @@
 int octstr_search_chars(const Octstr *ostr, const Octstr *chars, long pos)
 {
     long i, j;
-    for(i=0; i < octstr_len(chars); i++) {
-	j = octstr_search_char(ostr, octstr_get_char(chars, i), 0);
-	if(j != -1)
+
+    seems_valid(ostr);
+    seems_valid(chars);
+    gw_assert(pos >= 0);
+
+    for (i = 0; i < octstr_len(chars); i++) {
+	j = octstr_search_char(ostr, octstr_get_char(chars, i), pos);
+	if (j != -1)
 	    return j;
     }
+
     return -1;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.