strbuf.c: move declarations that are not declared at the beginning of a scope block
This commit is contained in:
parent
362b845030
commit
c558135c63
1 changed files with 4 additions and 5 deletions
|
|
@ -161,20 +161,19 @@ void strbuf_rev(strbuf_t *s) {
|
||||||
|
|
||||||
void strbuf_squeeze(strbuf_t *s, char ch) {
|
void strbuf_squeeze(strbuf_t *s, char ch) {
|
||||||
|
|
||||||
size_t p;
|
size_t p, np, of;
|
||||||
|
|
||||||
for(p=s->len; p; p--) {
|
for(p=s->len; p; p--) {
|
||||||
|
|
||||||
if (s->buf[p-1] != ch)
|
if (s->buf[p-1] != ch)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
size_t np = p, of = 0;
|
np = p;
|
||||||
|
|
||||||
for(; np-1 && s->buf[np-2] == ch; np--)
|
for(of = 0; np-1 && s->buf[np-2] == ch; np--)
|
||||||
of++;
|
of++;
|
||||||
|
|
||||||
if (of) {
|
if (of) {
|
||||||
|
|
||||||
p = np;
|
p = np;
|
||||||
for(s->len -= of; np <= s->len; np++)
|
for(s->len -= of; np <= s->len; np++)
|
||||||
s->buf[np] = s->buf[np + of];
|
s->buf[np] = s->buf[np + of];
|
||||||
|
|
|
||||||
Reference in a new issue