diff options
Diffstat (limited to 'src/vpp-api/client/stat_client.h')
-rw-r--r-- | src/vpp-api/client/stat_client.h | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h index b2457ad6e48..730badd1728 100644 --- a/src/vpp-api/client/stat_client.h +++ b/src/vpp-api/client/stat_client.h @@ -101,12 +101,10 @@ _time_now_nsec (void) static inline void * stat_segment_adjust (stat_client_main_t * sm, void *data) { - void *p = (void *) ((char *) sm->shared_header + - ((char *) data - (char *) sm->shared_header->base)); - if ((char *) p > (char *) sm->shared_header && - (((char *) p + sizeof (p)) < - ((char *) sm->shared_header + sm->memory_size))) - return p; + char *csh = (char *) sm->shared_header; + char *p = csh + ((char *) data - (char *) sm->shared_header->base); + if (p > csh && p + sizeof (p) < csh + sm->memory_size) + return (void *) p; return 0; } |