strbuf API additions and enhancements.

Add strbuf_remove, change strbuf_insert:
  As both are special cases of strbuf_splice, implement them as such.
  gcc is able to do the math and generate almost optimal code this way.

Add strbuf_swap:
  Exchange the values of its arguments.
  Use it in fast-import.c

Also fix spacing issues in strbuf.h

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
Pierre Habouzit
2007-09-20 00:42:12 +02:00
committed by Junio C Hamano
parent 19247e5510
commit c76689df6c
4 changed files with 23 additions and 20 deletions

View File

@ -1111,9 +1111,7 @@ static int store_object(
if (last->no_swap) {
last->data = *dat;
} else {
struct strbuf tmp = *dat;
*dat = last->data;
last->data = tmp;
strbuf_swap(&last->data, dat);
}
last->offset = e->offset;
}