summaryrefslogtreecommitdiff
path: root/src/c
diff options
context:
space:
mode:
authorBrijeshcr2017-07-13 16:19:24 +0530
committerBrijeshcr2017-07-13 16:19:24 +0530
commite5aa8092912f6428694fc730c9db0d6cef9b25c7 (patch)
tree605b278bc0a1907734b17bcf7e725e57fbf3470f /src/c
parent09446b579acaf802438810bac018cbf56e1427ca (diff)
parent80f28fa1d04700d0813a99df57de27039d236e26 (diff)
downloadScilab2C_fossee_old-e5aa8092912f6428694fc730c9db0d6cef9b25c7.tar.gz
Scilab2C_fossee_old-e5aa8092912f6428694fc730c9db0d6cef9b25c7.tar.bz2
Scilab2C_fossee_old-e5aa8092912f6428694fc730c9db0d6cef9b25c7.zip
Ankit's merge
Diffstat (limited to 'src/c')
-rw-r--r--src/c/string/strcspn/gstrcspna.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/c/string/strcspn/gstrcspna.c b/src/c/string/strcspn/gstrcspna.c
index 2c83c72..91de8af 100644
--- a/src/c/string/strcspn/gstrcspna.c
+++ b/src/c/string/strcspn/gstrcspna.c
@@ -14,19 +14,28 @@
#include "strcspn.h"
uint8 gstrcspna(char *str1,int size1,char *str2,int size2)
{
- int ind,i,j;
- for(i=0;i<=size2;i++)
+ uint8 ind=size1+1;
+ int l,m;
+ for(m=0;m<size2;m++)
{
- for(j=0;j<=size1;j++)
- {
- if(str2[i]==str1[j])
+ int tp;
+ for(l=0;l<size1;l++)
{
- ind=j;
- break;
+ if(str2[m]==str1[l])
+ {
+ tp=l;
+ if(ind>tp)
+ {
+ ind=tp;
+ }
+ }
}
- }
}
- return (ind+1);
+ if(ind==size1+1)
+ {
+ ind=size1;
+ }
+ return ind;
}