summaryrefslogtreecommitdiff
path: root/lib/avp.c
diff options
context:
space:
mode:
authorLuke Howard <lukeh@padl.com>2011-11-14 22:58:53 +1100
committerLuke Howard <lukeh@padl.com>2011-11-14 22:58:53 +1100
commit53dc68c8a5a3edb904ca937dada67380701f18b0 (patch)
treed8f30c29d51672e00aaec71f321ebc37374b19ec /lib/avp.c
parentd9ae6534eed05639403584b7b2733ec36c08f1a4 (diff)
small cleanups
Diffstat (limited to 'lib/avp.c')
-rw-r--r--lib/avp.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/avp.c b/lib/avp.c
index 5af6129..6f30d4c 100644
--- a/lib/avp.c
+++ b/lib/avp.c
@@ -25,14 +25,19 @@ rs_avp_free (rs_avp **vps)
size_t
rs_avp_length (rs_const_avp *vp)
{
- assert (vp != NULL);
+ if (vp == NULL)
+ return 0;
+
return vp->length;
}
rs_attr_type_t
rs_avp_typeof (rs_const_avp *vp)
{
- return vp ? vp->da->type : RS_TYPE_INVALID;
+ if (vp == NULL)
+ return RS_TYPE_INVALID;
+
+ return vp->da->type;
}
void
@@ -40,6 +45,8 @@ rs_avp_attrid (rs_const_avp *vp,
unsigned int *attr,
unsigned int *vendor)
{
+ assert (vp != NULL);
+
*attr = vp->da->attr;
*vendor = vp->da->vendor;
}
@@ -47,7 +54,7 @@ rs_avp_attrid (rs_const_avp *vp,
const char *
rs_avp_name (rs_const_avp *vp)
{
- return vp ? vp->da->name : NULL;
+ return (vp != NULL) ? vp->da->name : NULL;
}
void
@@ -127,15 +134,15 @@ rs_avp_dup (rs_const_avp *vp)
}
rs_avp *
-rs_avp_next (rs_avp *avp)
+rs_avp_next (rs_avp *vp)
{
- return avp ? avp->next : NULL;
+ return (vp != NULL) ? vp->next : NULL;
}
rs_const_avp *
-rs_avp_next_const (rs_const_avp *avp)
+rs_avp_next_const (rs_const_avp *vp)
{
- return avp ? avp->next : NULL;
+ return (vp != NULL) ? vp->next : NULL;
}
int