libmsc/msc_vty.c: do not abuse strlen() to check char buffers
In the most cases we need to check whether particular char buffer is empty or not. Using strlen() for that involves more CPU power, so let's just check the first character against '\0'. Change-Id: I8728876b80c870e82247e6e56f719e10ed322a95
This commit is contained in:
parent
8014917f0a
commit
dcf2868e62
|
@ -793,11 +793,11 @@ static void vty_dump_one_subscr(struct vty *vty, struct vlr_subscr *vsub,
|
|||
{
|
||||
char buf[128];
|
||||
|
||||
if (strlen(vsub->name)) {
|
||||
if (vsub->name[0] != '\0') {
|
||||
MSC_VTY_DUMP(vty, offset, "Name: '%s'%s",
|
||||
vsub->name, VTY_NEWLINE);
|
||||
}
|
||||
if (strlen(vsub->msisdn)) {
|
||||
if (vsub->msisdn[0] != '\0') {
|
||||
MSC_VTY_DUMP(vty, offset, "MSISDN: %s%s",
|
||||
vsub->msisdn, VTY_NEWLINE);
|
||||
}
|
||||
|
@ -873,8 +873,7 @@ static void vty_dump_one_subscr(struct vty *vty, struct vlr_subscr *vsub,
|
|||
osmo_fsm_inst_state_name(vsub->sgs_fsm),
|
||||
VTY_NEWLINE);
|
||||
MSC_VTY_DUMP(vty, offset, "SGs-MME: %s%s",
|
||||
strlen(vsub->sgs.mme_name) ?
|
||||
vsub->sgs.mme_name : "(none)",
|
||||
vsub->sgs.mme_name[0] != '\0' ? vsub->sgs.mme_name : "(none)",
|
||||
VTY_NEWLINE);
|
||||
|
||||
MSC_VTY_DUMP(vty, offset, "Use count total: %d%s",
|
||||
|
|
Loading…
Reference in New Issue