diff --git a/src/strbuf.c b/src/strbuf.c index f0ca42f..fc3ac9f 100644 --- a/src/strbuf.c +++ b/src/strbuf.c @@ -161,20 +161,19 @@ void strbuf_rev(strbuf_t *s) { void strbuf_squeeze(strbuf_t *s, char ch) { - size_t p; + size_t p, np, of; for(p=s->len; p; p--) { if (s->buf[p-1] != ch) continue; - size_t np = p, of = 0; - - for(; np-1 && s->buf[np-2] == ch; np--) + np = p; + + for(of = 0; np-1 && s->buf[np-2] == ch; np--) of++; if (of) { - p = np; for(s->len -= of; np <= s->len; np++) s->buf[np] = s->buf[np + of];