]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: let vty.c manage its own pointers 538/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 16 May 2017 15:51:30 +0000 (15:51 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 16 May 2017 15:59:51 +0000 (15:59 +0000)
vty.c doesn't require back refs for a couple threads

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/vty.c

index e490d30a8af8ac0cfe0ae7129f8b1e03f13c2cda..56ec7072826674791e05c30e63d0a4aa3746de38 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2633,18 +2633,18 @@ static struct thread_master *vty_master;
 static void
 vty_event (enum event event, int sock, struct vty *vty)
 {
+  struct thread *vty_serv_thread = NULL;
+
   switch (event)
     {
     case VTY_SERV:
-      vector_set_index (Vvty_serv_thread, sock, NULL);
-      thread_add_read(vty_master, vty_accept, vty, sock,
-                      (struct thread **) &Vvty_serv_thread->index[sock]);
+      vty_serv_thread = thread_add_read(vty_master, vty_accept, vty, sock, NULL);
+      vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
       break;
 #ifdef VTYSH
     case VTYSH_SERV:
-      vector_set_index (Vvty_serv_thread, sock, NULL);
-      thread_add_read(vty_master, vtysh_accept, vty, sock,
-                      (struct thread **) &Vvty_serv_thread->index[sock]);
+      vty_serv_thread = thread_add_read(vty_master, vtysh_accept, vty, sock, NULL);
+      vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
       break;
     case VTYSH_READ:
       vty->t_read = NULL;