summaryrefslogtreecommitdiffstats
path: root/ospfd/ospf_apiserver.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-05-05 23:22:25 +0200
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-05-09 22:44:22 +0200
commit66e78ae64bc4659848517953b365606e3e70e878 (patch)
treeef1339e397feed2b56b8d653d41c03aa5b2bd94f /ospfd/ospf_apiserver.c
parentlib: safely check & set thread pointers (diff)
downloadfrr-66e78ae64bc4659848517953b365606e3e70e878.tar.xz
frr-66e78ae64bc4659848517953b365606e3e70e878.zip
*: update thread_add_* calls
Pass pointer to pointer instead of assigning by return value. See previous commit message. To ensure that the behavior stays functionally correct, any assignments with the result of a thread_add* function have been transformed to set the pointer to null before passing it. These can be removed wherever the pointer is known to already be null. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'ospfd/ospf_apiserver.c')
-rw-r--r--ospfd/ospf_apiserver.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index 5c514e18f..633b22346 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -304,30 +304,24 @@ ospf_apiserver_event (enum event event, int fd,
(void) thread_add_read(master, ospf_apiserver_accept, apiserv, fd, NULL);
break;
case OSPF_APISERVER_SYNC_READ:
- apiserv->t_sync_read =
- thread_add_read(master, ospf_apiserver_read, apiserv, fd, NULL);
+ apiserv->t_sync_read = NULL;
+ thread_add_read(master, ospf_apiserver_read, apiserv, fd,
+ &apiserv->t_sync_read);
break;
#ifdef USE_ASYNC_READ
case OSPF_APISERVER_ASYNC_READ:
- apiserv->t_async_read =
- thread_add_read(master, ospf_apiserver_read, apiserv, fd, NULL);
+ apiserv->t_async_read = NULL;
+ thread_add_read(master, ospf_apiserver_read, apiserv, fd,
+ &apiserv->t_async_read);
break;
#endif /* USE_ASYNC_READ */
case OSPF_APISERVER_SYNC_WRITE:
- if (!apiserv->t_sync_write)
- {
- apiserv->t_sync_write =
- thread_add_write(master, ospf_apiserver_sync_write, apiserv, fd,
- NULL);
- }
+ thread_add_write(master, ospf_apiserver_sync_write, apiserv, fd,
+ &apiserv->t_sync_write);
break;
case OSPF_APISERVER_ASYNC_WRITE:
- if (!apiserv->t_async_write)
- {
- apiserv->t_async_write =
- thread_add_write(master, ospf_apiserver_async_write, apiserv, fd,
- NULL);
- }
+ thread_add_write(master, ospf_apiserver_async_write, apiserv, fd,
+ &apiserv->t_async_write);
break;
}
}