Dolda2000 GitWeb
/
ashd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
cac1315
)
lib: Added the bufdel macro.
author
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 28 Dec 2012 06:14:12 +0000
(07:14 +0100)
committer
Fredrik Tolf
<fredrik@dolda2000.com>
Fri, 28 Dec 2012 06:14:12 +0000
(07:14 +0100)
lib/utils.h
patch
|
blob
|
blame
|
history
diff --git
a/lib/utils.h
b/lib/utils.h
index
2de1df6
..
2066918
100644
(file)
--- a/
lib/utils.h
+++ b/
lib/utils.h
@@
-16,6
+16,7
@@
#define bufinit(buf) memset(&(buf), 0, sizeof(buf))
#define buffree(buf) do { if((buf).b != NULL) {free((buf).b);} bufinit(buf); } while(0)
#define sizebuf(buf, wanted) (_sizebuf((struct buffer *)&(buf), (wanted), sizeof(*((buf).b))))
+#define bufdel(buf, i) (memmove((buf).b + (i), (buf).b + (i) + 1, (--((buf).d) - (i)) * sizeof(*((buf).b))))
#define bufadd(buf, new) \
do { \
_sizebuf((struct buffer *)&(buf), (buf).d + 1, sizeof(*((buf).b))); \