diff options
author | jackiechen1985 <xiaobo.chen@tieto.com> | 2019-04-12 16:33:21 +0800 |
---|---|---|
committer | jackiechen1985 <xiaobo.chen@tieto.com> | 2019-04-12 16:33:21 +0800 |
commit | 59f098dd4dc6371346f50dd532b87fd014b55168 (patch) | |
tree | 4b64238df0601c487a40d87f19a3df2e332f8f6d | |
parent | 3320f7c7224e051b4a30a74e0a683159ed8b9dea (diff) |
Fix bugs in comm.h
1. Fix id error while pushing a new element. The new element id should indicate the stack length, not the old one;
2. Fix dump callback return VAPI_EINVAL in last call. In last call, we should ignore replication because VPP pass NULL pointer while is_last is true;
Change-Id: I8b14a3fda3b168c82d28470edc8b11cad6ebadc8
Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
-rw-r--r-- | src/scvpp/inc/scvpp/comm.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/scvpp/inc/scvpp/comm.h b/src/scvpp/inc/scvpp/comm.h index 9a27517..8d2b2e2 100644 --- a/src/scvpp/inc/scvpp/comm.h +++ b/src/scvpp/inc/scvpp/comm.h @@ -142,7 +142,7 @@ static inline int push(struct elt **stack, void *data, int length) memcpy(el->data, data, length); if (*stack) - el->id = (*stack)->id++; + el->id = (*stack)->id + 1; else el->id = 0; el->next = *stack; //point to old value of stack @@ -174,8 +174,13 @@ static vapi_error_e \ api_name##_all_cb(vapi_ctx_t ctx, void *caller_ctx, vapi_error_e rv, bool is_last, \ vapi_payload_##api_name##_details *reply) \ { \ - UNUSED(ctx); UNUSED(rv); UNUSED(is_last); \ + UNUSED(ctx); UNUSED(rv); \ struct elt **stackp; \ + \ + if (is_last) { \ + return VAPI_OK; \ + } \ + \ ARG_CHECK2(VAPI_EINVAL, caller_ctx, reply); \ \ stackp = (struct elt**) caller_ctx; \ |