summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2004-11-13 08:11:12 +0000
committerChristos Zoulas <christos@zoulas.com>2004-11-13 08:11:12 +0000
commit719f3ce839082f8d460e5c58ff9be60ff9a7ce90 (patch)
tree9ca36a75ae6c29466534aeafe0846994b6cae336
parent38640f9d0b4508ed9202b861bcd3a43ba79c34e9 (diff)
downloadfile-git-719f3ce839082f8d460e5c58ff9be60ff9a7ce90.tar.gz
simplify the logic
-rw-r--r--src/softmagic.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/softmagic.c b/src/softmagic.c
index 5b832154..4fc1af83 100644
--- a/src/softmagic.c
+++ b/src/softmagic.c
@@ -39,7 +39,7 @@
#ifndef lint
-FILE_RCSID("@(#)$Id: softmagic.c,v 1.68 2004/10/12 14:55:09 christos Exp $")
+FILE_RCSID("@(#)$Id: softmagic.c,v 1.69 2004/11/13 08:11:12 christos Exp $")
#endif /* lint */
private int match(struct magic_set *, struct magic *, uint32_t,
@@ -427,8 +427,8 @@ mconvert(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
/* Null terminate and eat *trailing* return */
p->s[sizeof(p->s) - 1] = '\0';
len = strlen(p->s);
- if (len && p->s[len - 1] == '\n')
- p->s[len - 1] = '\0';
+ if (len-- && p->s[len] == '\n')
+ p->s[len] = '\0';
return 1;
}
case FILE_PSTRING:
@@ -441,8 +441,8 @@ mconvert(struct magic_set *ms, union VALUETYPE *p, struct magic *m)
*ptr1++ = *ptr2++;
*ptr1 = '\0';
len = strlen(p->s);
- if (len && p->s[len - 1] == '\n')
- p->s[len - 1] = '\0';
+ if (len-- && p->s[len] == '\n')
+ p->s[len] = '\0';
return 1;
}
case FILE_BESHORT: