diff options
author | Vratko Polak <vrpolak@cisco.com> | 2020-12-02 18:45:16 +0100 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2020-12-03 13:41:28 +0000 |
commit | 18a71d8af56f4a70c9257608eb6e71b9cdc9f2ae (patch) | |
tree | 5f0e77759a5b96ada7e4b1442683731083f9d769 /src/vpp-api | |
parent | d417fe2616d7b10cd842187aa160516b35831fc7 (diff) |
stats: char-pointer arithmetic style-up
Char* typed shared_header value appears multiple times,
so store it is a variable.
Pointer "p" value is used more frequently casted to char*,
so use that type for it, and convert to void* only at return.
Type: style
Fixes: 41f15ae1dfd4ac1777b684fdc763d12496209418
Change-Id: I7b3f1e6a43c020acd7ae561f87d12237b07fcd66
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'src/vpp-api')
-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; } |