Sat Jul 12 10:08:48 EDT 2008 Pekka Pessi <first.last@nokia.com>

* tport.c: checking for non-NULL pointer in predicate functions



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9264 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2008-08-12 17:01:58 +00:00
parent ecef7d5421
commit 25e78b6a9c
2 changed files with 7 additions and 7 deletions

View File

@ -1 +1 @@
Tue Aug 12 13:00:08 EDT 2008 Tue Aug 12 13:01:49 EDT 2008

View File

@ -196,31 +196,31 @@ int tport_is_secondary(tport_t const *self)
/** Test if transport has been registered to su_root_t */ /** Test if transport has been registered to su_root_t */
int tport_is_registered(tport_t const *self) int tport_is_registered(tport_t const *self)
{ {
return self->tp_index != 0; return self && self->tp_index != 0;
} }
/** Test if transport is stream. */ /** Test if transport is stream. */
int tport_is_stream(tport_t const *self) int tport_is_stream(tport_t const *self)
{ {
return self->tp_addrinfo->ai_socktype == SOCK_STREAM; return self && self->tp_addrinfo->ai_socktype == SOCK_STREAM;
} }
/** Test if transport is dgram. */ /** Test if transport is dgram. */
int tport_is_dgram(tport_t const *self) int tport_is_dgram(tport_t const *self)
{ {
return self->tp_addrinfo->ai_socktype == SOCK_DGRAM; return self && self->tp_addrinfo->ai_socktype == SOCK_DGRAM;
} }
/** Test if transport is udp. */ /** Test if transport is udp. */
int tport_is_udp(tport_t const *self) int tport_is_udp(tport_t const *self)
{ {
return self->tp_addrinfo->ai_protocol == IPPROTO_UDP; return self && self->tp_addrinfo->ai_protocol == IPPROTO_UDP;
} }
/** Test if transport is tcp. */ /** Test if transport is tcp. */
int tport_is_tcp(tport_t const *self) int tport_is_tcp(tport_t const *self)
{ {
return self->tp_addrinfo->ai_protocol == IPPROTO_TCP; return self && self->tp_addrinfo->ai_protocol == IPPROTO_TCP;
} }
/** Return 1 if transport is reliable, 0 otherwise. /** Return 1 if transport is reliable, 0 otherwise.
@ -242,7 +242,7 @@ int tport_is_reliable(tport_t const *self)
*/ */
int tport_is_public(tport_t const *self) int tport_is_public(tport_t const *self)
{ {
return self->tp_pri->pri_public; return self && self->tp_pri->pri_public;
} }
/** Return true if transport supports IPv4 */ /** Return true if transport supports IPv4 */