apps/netbiosns: Convert to use lwip_isupper instead of open-coded

Also remove additonal (cname == '\0' || cname == '.') check because
it's covered by !lwip_isupper(cname) test.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
This commit is contained in:
Axel Lin 2018-07-03 22:55:59 +08:00
parent 58be2b1573
commit 9b638e7c05

View File

@ -245,7 +245,7 @@ netbiosns_name_decode(char *name_enc, char *name_dec, int name_dec_len)
if (cname == '.') { if (cname == '.') {
break; /* scope ID follows */ break; /* scope ID follows */
} }
if (cname < 'A' || cname > 'Z') { if (!lwip_isupper(cname)) {
/* Not legal. */ /* Not legal. */
return -1; return -1;
} }
@ -254,12 +254,7 @@ netbiosns_name_decode(char *name_enc, char *name_dec, int name_dec_len)
pname++; pname++;
cname = *pname; cname = *pname;
if (cname == '\0' || cname == '.') { if (!lwip_isupper(cname)) {
/* No more characters in the name - but we're in
* the middle of a pair. Not legal. */
return -1;
}
if (cname < 'A' || cname > 'Z') {
/* Not legal. */ /* Not legal. */
return -1; return -1;
} }