diff options
author | Brijeshcr | 2017-07-13 16:19:24 +0530 |
---|---|---|
committer | Brijeshcr | 2017-07-13 16:19:24 +0530 |
commit | 5f5d373de3a5c91af4eebc1eefd765b19802469d (patch) | |
tree | 59c8924270a6ae948caabfc1ecfe6ec1e318e418 /2.3-1/src | |
parent | 1c5c5704b2c0a6e6f6650f74968261a6842f2038 (diff) | |
parent | 3052ef8a1ddfb6d50984e90b3fbcf54edc9dd74b (diff) | |
download | Scilab2C-5f5d373de3a5c91af4eebc1eefd765b19802469d.tar.gz Scilab2C-5f5d373de3a5c91af4eebc1eefd765b19802469d.tar.bz2 Scilab2C-5f5d373de3a5c91af4eebc1eefd765b19802469d.zip |
Ankit's merge
Diffstat (limited to '2.3-1/src')
-rw-r--r-- | 2.3-1/src/c/string/strcspn/gstrcspna.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/2.3-1/src/c/string/strcspn/gstrcspna.c b/2.3-1/src/c/string/strcspn/gstrcspna.c index 2c83c724..91de8af7 100644 --- a/2.3-1/src/c/string/strcspn/gstrcspna.c +++ b/2.3-1/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; } |