Revert unnecessary Strcmp length arg. - sam - An updated version of the sam tex… | |
git clone git://vernunftzentrum.de/sam.git | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 262f57a929140104432adf15318c847331694706 | |
parent 3ee8f386ebc7f68c1c2b27c20ffed8b973bf812b | |
Author: Rob King <[email protected]> | |
Date: Thu, 26 May 2016 22:05:02 -0500 | |
Revert unnecessary Strcmp length arg. | |
Diffstat: | |
sam/io.c | 2 +- | |
sam/multi.c | 4 ++-- | |
sam/regexp.c | 2 +- | |
sam/sam.c | 4 ++-- | |
sam/sam.h | 2 +- | |
sam/string.c | 10 ++-------- | |
6 files changed, 9 insertions(+), 15 deletions(-) | |
--- | |
diff --git a/sam/io.c b/sam/io.c | |
@@ -31,7 +31,7 @@ writef(File *f) | |
long mtime, appendonly, length; | |
newfile = 0; | |
- samename = Strcmp(&genstr, &f->name, NULL) == 0; | |
+ samename = Strcmp(&genstr, &f->name) == 0; | |
name = Strtoc(&f->name); | |
i = statfile(name, &dev, &qid, &mtime, 0, 0); | |
if(i == -1) | |
diff --git a/sam/multi.c b/sam/multi.c | |
@@ -55,7 +55,7 @@ sortname(File *f) | |
if(f == cmd) | |
i = 0; | |
else for(i=0; i<file.nused; i++){ | |
- cmp = Strcmp(&f->name, &file.filepptr[i]->name, NULL); | |
+ cmp = Strcmp(&f->name, &file.filepptr[i]->name); | |
if(cmp==0 && !dupwarned){ | |
dupwarned = TRUE; | |
warn_S(Wdupname, &f->name); | |
@@ -91,7 +91,7 @@ lookfile(String *s, int fuzzy) | |
for(i=0; i<file.nused; i++){ | |
int l2; | |
- if(Strcmp(&file.filepptr[i]->name, s, &l2) == 0) | |
+ if(Strcmp(&file.filepptr[i]->name, s) == 0) | |
return file.filepptr[i]; | |
if (fuzzy){ | |
diff --git a/sam/regexp.c b/sam/regexp.c | |
@@ -181,7 +181,7 @@ compile(String *s) | |
int i; | |
Inst *oprogp; | |
- if(Strcmp(s, &lastregexp, NULL)==0) | |
+ if(Strcmp(s, &lastregexp)==0) | |
return; | |
for(i=0; i<nclass; i++) | |
free(class[i]); | |
diff --git a/sam/sam.c b/sam/sam.c | |
@@ -324,7 +324,7 @@ edit(File *f, int cmd) | |
if(cmd=='e' || cmd=='I'){ | |
Fdelete(f, (Posn)0, f->nrunes); | |
addr.r.p2 = f->nrunes; | |
- }else if(f->nrunes!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name, NU… | |
+ }else if(f->nrunes!=0 || (f->name.s[0] && Strcmp(&genstr, &f->name)!=0… | |
empty = FALSE; | |
if((io = open(genc, OREAD))<0) { | |
if (curfile && curfile->state == Unread) | |
@@ -375,7 +375,7 @@ getname(File *f, String *s, int save) | |
Straddc(&genstr, '\0'); | |
if(f && (save || f->name.s[0]==0)){ | |
Fsetname(f, &genstr); | |
- if(Strcmp(&f->name, &genstr, NULL)){ | |
+ if(Strcmp(&f->name, &genstr)){ | |
quitok = f->closeok = FALSE; | |
f->qid = 0; | |
f->date = 0; | |
diff --git a/sam/sam.h b/sam/sam.h | |
@@ -305,7 +305,7 @@ int statfd(int, ulong*, ulong*, long*, long*, long*); | |
int statfile(char*, ulong*, ulong*, long*, long*, long*); | |
void Straddc(String*, int); | |
void Strclose(String*); | |
-int Strcmp(String*, String*, int *); | |
+int Strcmp(String*, String*); | |
void Strdelete(String*, Posn, Posn); | |
void Strdupl(String*, Rune*); | |
void Strduplstr(String*, String*); | |
diff --git a/sam/string.c b/sam/string.c | |
@@ -100,19 +100,13 @@ Strdelete(String *p, Posn p1, Posn p2) | |
} | |
int | |
-Strcmp(String *a, String *b, int *l) | |
+Strcmp(String *a, String *b) | |
{ | |
int i, c; | |
- if (l) | |
- *l = 0; | |
- | |
- for(i=0; i<a->n && i<b->n; i++){ | |
+ for(i=0; i<a->n && i<b->n; i++) | |
if(c = (a->s[i] - b->s[i])) /* assign = */ | |
return c; | |
- if (l) | |
- (*l)++; | |
- } | |
/* damn NULs confuse everything */ | |
i = a->n - b->n; | |
if(i == 1){ |