exit_remote_server: avoid clang static analysis warning

if IsServer(source_p) then the following must be all non-NULL:
 ->serv
 ->servptr
 ->servptr->serv

Remove unnecessary and inconsistent pointer checks.
This commit is contained in:
Simon Arlott 2017-07-29 19:17:34 +01:00
parent 630c15211d
commit 6c1e15a432
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24
2 changed files with 4 additions and 8 deletions

View file

@ -1412,13 +1412,9 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie
snprintf(newcomment, sizeof(newcomment), "by %s: %s", snprintf(newcomment, sizeof(newcomment), "by %s: %s",
from->name, comment); from->name, comment);
if(source_p->serv != NULL)
remove_dependents(client_p, source_p, from, IsPerson(from) ? newcomment : comment, comment1); remove_dependents(client_p, source_p, from, IsPerson(from) ? newcomment : comment, comment1);
if(source_p->servptr && source_p->servptr->serv)
rb_dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers); rb_dlinkDelete(&source_p->lnode, &source_p->servptr->serv->servers);
else
s_assert(0);
rb_dlinkFindDestroy(source_p, &global_serv_list); rb_dlinkFindDestroy(source_p, &global_serv_list);
target_p = source_p->from; target_p = source_p->from;
@ -1436,6 +1432,7 @@ exit_remote_server(struct Client *client_p, struct Client *source_p, struct Clie
del_from_client_hash(source_p->name, source_p); del_from_client_hash(source_p->name, source_p);
remove_client_from_list(source_p); remove_client_from_list(source_p);
scache_split(source_p->serv->nameinfo); scache_split(source_p->serv->nameinfo);
SetDead(source_p); SetDead(source_p);

View file

@ -860,8 +860,6 @@ server_estab(struct Client *client_p)
sendto_one(client_p, "SVINFO %d %d 0 :%ld", TS_CURRENT, TS_MIN, (long int)rb_current_time()); sendto_one(client_p, "SVINFO %d %d 0 :%ld", TS_CURRENT, TS_MIN, (long int)rb_current_time());
SetServer(client_p);
rb_dlinkAdd(client_p, &client_p->lnode, &me.serv->servers); rb_dlinkAdd(client_p, &client_p->lnode, &me.serv->servers);
rb_dlinkMoveNode(&client_p->localClient->tnode, &unknown_list, &serv_list); rb_dlinkMoveNode(&client_p->localClient->tnode, &unknown_list, &serv_list);
rb_dlinkAddTailAlloc(client_p, &global_serv_list); rb_dlinkAddTailAlloc(client_p, &global_serv_list);
@ -872,6 +870,7 @@ server_estab(struct Client *client_p)
add_to_client_hash(client_p->name, client_p); add_to_client_hash(client_p->name, client_p);
/* doesnt duplicate client_p->serv if allocated this struct already */ /* doesnt duplicate client_p->serv if allocated this struct already */
make_server(client_p); make_server(client_p);
SetServer(client_p);
client_p->serv->caps = client_p->localClient->caps; client_p->serv->caps = client_p->localClient->caps;