diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-11-25 16:29:38 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-12-11 16:54:26 +0000 |
commit | 0aa4013e20471a7b23bc3252649c95c81b5d7519 (patch) | |
tree | 33fa625cc95b9feb23e512fc54a31152132e440d /src/vat | |
parent | cfdb109180cb01c17f92a465f925c244259ba06b (diff) |
api: Use vl_msg_push/pop_heap
Type: refactor
Change-Id: I0eb46676fc22ce6825b2d879498df344b5a855e8
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vat')
-rw-r--r-- | src/vat/api_format.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index e4ef0b4916b..ff61e9a99d1 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -1100,7 +1100,6 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp) { vat_main_t *vam = &vat_main; vat_json_node_t node; - api_main_t *am = vlibapi_get_main (); void *oldheap; u8 *reply; @@ -1109,14 +1108,12 @@ vl_api_cli_reply_t_handler_json (vl_api_cli_reply_t * mp) vat_json_object_add_uint (&node, "reply_in_shmem", ntohl (mp->reply_in_shmem)); /* Toss the shared-memory original... */ - pthread_mutex_lock (&am->vlib_rp->mutex); - oldheap = svm_push_data_heap (am->vlib_rp); + oldheap = vl_msg_push_heap (); reply = uword_to_pointer (mp->reply_in_shmem, u8 *); vec_free (reply); - svm_pop_heap (oldheap); - pthread_mutex_unlock (&am->vlib_rp->mutex); + vl_msg_pop_heap (oldheap); vat_json_print (vam->ofp, &node); vat_json_free (&node); @@ -2710,7 +2707,6 @@ static void vl_api_get_node_graph_reply_t_handler (vl_api_get_node_graph_reply_t * mp) { vat_main_t *vam = &vat_main; - api_main_t *am = vlibapi_get_main (); i32 retval = ntohl (mp->retval); u8 *pvt_copy, *reply; void *oldheap; @@ -2735,13 +2731,11 @@ static void vl_api_get_node_graph_reply_t_handler pvt_copy = vec_dup (reply); /* Toss the shared-memory original... */ - pthread_mutex_lock (&am->vlib_rp->mutex); - oldheap = svm_push_data_heap (am->vlib_rp); + oldheap = vl_msg_push_heap (); vec_free (reply); - svm_pop_heap (oldheap); - pthread_mutex_unlock (&am->vlib_rp->mutex); + vl_msg_pop_heap (oldheap); if (vam->graph_nodes) { @@ -2773,7 +2767,6 @@ static void vl_api_get_node_graph_reply_t_handler_json (vl_api_get_node_graph_reply_t * mp) { vat_main_t *vam = &vat_main; - api_main_t *am = vlibapi_get_main (); void *oldheap; vat_json_node_t node; u8 *reply; @@ -2786,13 +2779,11 @@ static void vl_api_get_node_graph_reply_t_handler_json reply = uword_to_pointer (mp->reply_in_shmem, u8 *); /* Toss the shared-memory original... */ - pthread_mutex_lock (&am->vlib_rp->mutex); - oldheap = svm_push_data_heap (am->vlib_rp); + oldheap = vl_msg_push_heap (); vec_free (reply); - svm_pop_heap (oldheap); - pthread_mutex_unlock (&am->vlib_rp->mutex); + vl_msg_pop_heap (oldheap); vat_json_print (vam->ofp, &node); vat_json_free (&node); |