mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
itest: fix result of string compares
The implementation of the string compare function of the "itest" command was weird, as only the length of the shortest argument was included in the compare, with the result that something like "itest.s abd == abddef" would return TRUE. Fix this. Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Detlev Zundel <dzu@denx.de>
This commit is contained in:
parent
518075fc6a
commit
cc22b795fb
1 changed files with 2 additions and 5 deletions
|
@ -94,16 +94,13 @@ static char * evalstr(char *s)
|
|||
|
||||
static int stringcomp(char *s, char *t, int op)
|
||||
{
|
||||
int n, p;
|
||||
int p;
|
||||
char *l, *r;
|
||||
|
||||
l = evalstr(s);
|
||||
r = evalstr(t);
|
||||
|
||||
/* we'll do a compare based on the length of the shortest string */
|
||||
n = min(strlen(l), strlen(r));
|
||||
|
||||
p = strncmp(l, r, n);
|
||||
p = strcmp(l, r);
|
||||
switch (op) {
|
||||
case EQ: return (p == 0);
|
||||
case NE: return (p != 0);
|
||||
|
|
Loading…
Reference in a new issue