Permalink
Browse files

Rework the internals of CLIP() so that it always assigns something to…

… S(t);

this makes anal-compulsive C compilers (I'm looking at _you_, clang) stop
whining about unused values in expressions.
  • Loading branch information...
1 parent f171d49 commit b591d39757165951bff358e6a0351c7f29ad45fe david parsons committed Jan 24, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 cstring.h
View
4 cstring.h
@@ -27,9 +27,9 @@
#define DELETE(x) ALLOCATED(x) ? (free(T(x)), S(x) = (x).alloc = 0) \
: ( S(x) = 0 )
#define CLIP(t,i,sz) \
- ( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
+ S(t) -= ( ((i) >= 0) && ((sz) > 0) && (((i)+(sz)) <= S(t)) ) ? \
(memmove(&T(t)[i], &T(t)[i+sz], (S(t)-(i+sz)+1)*sizeof(T(t)[0])), \
- S(t) -= (sz)) : -1
+ (sz)) : 0
#define RESERVE(x, sz) T(x) = ((x).alloc > S(x) + (sz) \
? T(x) \

0 comments on commit b591d39

Please sign in to comment.