projects
/
mmh
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f3db624
)
Refactoring in sbr/m_convert.c
author
markus schnalke
<meillo@marmaro.de>
Thu, 5 Jan 2012 10:28:18 +0000
(11:28 +0100)
committer
markus schnalke
<meillo@marmaro.de>
Thu, 5 Jan 2012 10:28:18 +0000
(11:28 +0100)
sbr/m_convert.c
patch
|
blob
|
history
diff --git
a/sbr/m_convert.c
b/sbr/m_convert.c
index
b42a5aa
..
b535fe3
100644
(file)
--- a/
sbr/m_convert.c
+++ b/
sbr/m_convert.c
@@
-250,10
+250,12
@@
m_conv(struct msgs *mp, char *str, int call)
{
register int i;
register unsigned char *cp, *bp;
{
register int i;
register unsigned char *cp, *bp;
- unsigned char buf[16];
+ unsigned char buf[16]; /* for reserved sequence name */
convdir = 1;
cp = bp = str;
convdir = 1;
cp = bp = str;
+
+ /* Handle an integer */
if (isdigit(*cp)) {
while (isdigit(*bp))
bp++;
if (isdigit(*cp)) {
while (isdigit(*bp))
bp++;
@@
-276,39
+278,41
@@
m_conv(struct msgs *mp, char *str, int call)
*bp++ = '\0';
delimp = cp;
*bp++ = '\0';
delimp = cp;
- if (!strcmp(buf, seq_first))
+ /* Which one of the reserved names is it? */
+ if (strcmp(buf, seq_first)==0) {
return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ?
mp->lowmsg : BADMSG);
return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ?
mp->lowmsg : BADMSG);
- if (!strcmp(buf, seq_last)) {
+ } else if (strcmp(buf, seq_last)==0) {
convdir = -1;
return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ?
mp->hghmsg : BADMSG);
convdir = -1;
return (mp->hghmsg || !(mp->msgflags & ALLOW_BEYOND) ?
mp->hghmsg : BADMSG);
- }
- if (!strcmp(buf, seq_cur))
+ } else if (strcmp(buf, seq_cur)==0) {
return (mp->curmsg > 0 ? mp->curmsg : BADMSG);
return (mp->curmsg > 0 ? mp->curmsg : BADMSG);
- if (!strcmp(buf, seq_prev)) {
+ } else if (strcmp(buf, seq_prev)==0) {
convdir = -1;
convdir = -1;
- for (i = (mp->curmsg <= mp->hghmsg) ? mp->curmsg - 1 : mp->hghmsg;
- i >= mp->lowmsg; i--) {
+ for (i = (mp->curmsg <= mp->hghmsg) ?
+ mp->curmsg - 1 : mp->hghmsg;
+ i >= mp->lowmsg; i--) {
if (does_exist(mp, i))
return i;
}
return BADMSG;
if (does_exist(mp, i))
return i;
}
return BADMSG;
- }
- if (!strcmp(buf, seq_next)) {
- for (i = (mp->curmsg >= mp->lowmsg) ? mp->curmsg + 1 : mp->lowmsg;
- i <= mp->hghmsg; i++) {
+ } else if (strcmp(buf, seq_next)==0) {
+ for (i = (mp->curmsg >= mp->lowmsg) ?
+ mp->curmsg + 1 : mp->lowmsg;
+ i <= mp->hghmsg; i++) {
if (does_exist(mp, i))
return i;
}
return BADMSG;
if (does_exist(mp, i))
return i;
}
return BADMSG;
- }
- return BADLST;
+ } else {
+ return BADLST;
+ }
}
/*
}
/*