mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
bufferevent_pair: fix infer warnings due to upcast() return NULL
The only user that is care about this is bufferevent_pair_get_partner(), so let's move the check there.
This commit is contained in:
parent
92ea8476b4
commit
05ed7c8c7e
@ -56,8 +56,6 @@ static inline struct bufferevent_pair *
|
||||
upcast(struct bufferevent *bev)
|
||||
{
|
||||
struct bufferevent_pair *bev_p;
|
||||
if (!BEV_IS_PAIR(bev))
|
||||
return NULL;
|
||||
bev_p = EVUTIL_UPCAST(bev, struct bufferevent_pair, bev.bev);
|
||||
EVUTIL_ASSERT(BEV_IS_PAIR(&bev_p->bev.bev));
|
||||
return bev_p;
|
||||
@ -341,10 +339,9 @@ bufferevent_pair_get_partner(struct bufferevent *bev)
|
||||
{
|
||||
struct bufferevent_pair *bev_p;
|
||||
struct bufferevent *partner = NULL;
|
||||
bev_p = upcast(bev);
|
||||
if (! bev_p)
|
||||
if (!BEV_IS_PAIR(bev))
|
||||
return NULL;
|
||||
|
||||
bev_p = upcast(bev);
|
||||
incref_and_lock(bev);
|
||||
if (bev_p->partner)
|
||||
partner = downcast(bev_p->partner);
|
||||
|
Loading…
x
Reference in New Issue
Block a user