diff options
author | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
---|---|---|
committer | Renato Westphal <renato@opensourcerouting.org> | 2017-03-03 21:50:22 +0100 |
commit | 236c69359ec99e3683c1e0d92fd0262e1d350b95 (patch) | |
tree | bdf2d2befff75c35b30a36d45411ac1ad8b4e8bb /ldpd/ldpe.c | |
parent | ldpd: send VPLS MAC withdrawals (diff) | |
download | frr-236c69359ec99e3683c1e0d92fd0262e1d350b95.tar.xz frr-236c69359ec99e3683c1e0d92fd0262e1d350b95.zip |
ldpd: remove unnecessary memcpy's
Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to '')
-rw-r--r-- | ldpd/ldpe.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c index 93454cf27..3bb84e92a 100644 --- a/ldpd/ldpe.c +++ b/ldpd/ldpe.c @@ -540,10 +540,10 @@ ldpe_dispatch_lde(struct thread *thread) struct imsgev *iev = THREAD_ARG(thread); struct imsgbuf *ibuf = &iev->ibuf; struct imsg imsg; - struct map map; - struct notify_msg nm; + struct map *map; + struct notify_msg *nm; + struct nbr *nbr; int n, shut = 0; - struct nbr *nbr = NULL; iev->ev_read = NULL; @@ -563,9 +563,10 @@ ldpe_dispatch_lde(struct thread *thread) case IMSG_RELEASE_ADD: case IMSG_REQUEST_ADD: case IMSG_WITHDRAW_ADD: - if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(map)) + if (imsg.hdr.len - IMSG_HEADER_SIZE != + sizeof(struct map)) fatalx("invalid size of map request"); - memcpy(&map, imsg.data, sizeof(map)); + map = imsg.data; nbr = nbr_find_peerid(imsg.hdr.peerid); if (nbr == NULL) { @@ -578,16 +579,16 @@ ldpe_dispatch_lde(struct thread *thread) switch (imsg.hdr.type) { case IMSG_MAPPING_ADD: - mapping_list_add(&nbr->mapping_list, &map); + mapping_list_add(&nbr->mapping_list, map); break; case IMSG_RELEASE_ADD: - mapping_list_add(&nbr->release_list, &map); + mapping_list_add(&nbr->release_list, map); break; case IMSG_REQUEST_ADD: - mapping_list_add(&nbr->request_list, &map); + mapping_list_add(&nbr->request_list, map); break; case IMSG_WITHDRAW_ADD: - mapping_list_add(&nbr->withdraw_list, &map); + mapping_list_add(&nbr->withdraw_list, map); break; } break; @@ -624,9 +625,10 @@ ldpe_dispatch_lde(struct thread *thread) } break; case IMSG_NOTIFICATION_SEND: - if (imsg.hdr.len - IMSG_HEADER_SIZE != sizeof(nm)) + if (imsg.hdr.len - IMSG_HEADER_SIZE != + sizeof(struct notify_msg)) fatalx("invalid size of OE request"); - memcpy(&nm, imsg.data, sizeof(nm)); + nm = imsg.data; nbr = nbr_find_peerid(imsg.hdr.peerid); if (nbr == NULL) { @@ -637,7 +639,7 @@ ldpe_dispatch_lde(struct thread *thread) if (nbr->state != NBR_STA_OPER) break; - send_notification_full(nbr->tcp, &nm); + send_notification_full(nbr->tcp, nm); break; case IMSG_CTL_END: case IMSG_CTL_SHOW_LIB: |