Skip to content

Commit

Permalink
vpool 'pool->v_off - where > 0' will work as 'pool->v_off != where'
Browse files Browse the repository at this point in the history
Fix PVS-Studio issues:
src/vpool.c:153: warning: V555 The expression 'pool->v_off - where > 0'
will work as 'pool->v_off != where'.
src/vpool.c:182: warning: V555 The expression 'pool->v_off - where > 0'
will work as 'pool->v_off != where'.
  • Loading branch information
nmariusp authored and mar-v-in committed Nov 14, 2022
1 parent 8ff4d23 commit 32e43fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vpool.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ vpool_insert(struct vpool *pool, size_t where, void *data, size_t datsize)
where = pool->v_off;

ret = (char *)pool->v_buf + where;
if (pool->v_off - where > 0)
if (pool->v_off > where)
memmove(ret + datsize, ret, pool->v_off - where);
memcpy(ret, data, datsize);
pool->v_off += datsize;
Expand Down Expand Up @@ -179,7 +179,7 @@ vpool_expand(struct vpool *pool, size_t where, size_t size)
where = pool->v_off;

ret = (char *)pool->v_buf + where;
if (pool->v_off - where > 0)
if (pool->v_off > where)
memmove(ret + size, ret, pool->v_off - where);
pool->v_off += size;
pool->v_lasterr = 0;
Expand Down

0 comments on commit 32e43fa

Please sign in to comment.