summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnkitr192017-07-12 20:44:33 +0530
committerAnkitr192017-07-12 20:44:33 +0530
commit80f28fa1d04700d0813a99df57de27039d236e26 (patch)
tree165b34c13fc1f0d0d048a764829f5cb8ce128a35
parentd0a1f4e5dcddab2290f68a0395970ec471813119 (diff)
downloadScilab2C_fossee_old-80f28fa1d04700d0813a99df57de27039d236e26.tar.gz
Scilab2C_fossee_old-80f28fa1d04700d0813a99df57de27039d236e26.tar.bz2
Scilab2C_fossee_old-80f28fa1d04700d0813a99df57de27039d236e26.zip
strcspn error removed
-rw-r--r--jar/scilab_en_US_help.jarbin11210 -> 11210 bytes
-rw-r--r--src/c/string/strcspn/gstrcspna.c27
2 files changed, 18 insertions, 9 deletions
diff --git a/jar/scilab_en_US_help.jar b/jar/scilab_en_US_help.jar
index 42fc9ad..5ab633f 100644
--- a/jar/scilab_en_US_help.jar
+++ b/jar/scilab_en_US_help.jar
Binary files differ
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;
}