chiark
/
gitweb
/
~mdw
/
mLib
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
struct/sym.c: Fix loading following table extension.
[mLib]
/
struct
/
darray.c
diff --git
a/struct/darray.c
b/struct/darray.c
index aa7e4a29ac933ffeca80ebd8af7b49691d65367a..ed849954bbce6da74daf24d3a9638410cd1d4800 100644
(file)
--- a/
struct/darray.c
+++ b/
struct/darray.c
@@
-27,13
+27,12
@@
/*----- Header files ------------------------------------------------------*/
/*----- Header files ------------------------------------------------------*/
-#include <stdio.h>
#include <string.h>
#include <string.h>
-#include <stdlib.h>
#include "alloc.h"
#include "arena.h"
#include "darray.h"
#include "alloc.h"
#include "arena.h"
#include "darray.h"
+#include "growbuf.h"
/*----- Magic numbers -----------------------------------------------------*/
/*----- Magic numbers -----------------------------------------------------*/
@@
-111,8
+110,8
@@
void *da_ensure(da_base *b, void *v, size_t sz, size_t n)
* two which is big enough, starting at double the current size.
*/
* two which is big enough, starting at double the current size.
*/
- nsz =
v ? b->sz + b->off : (DA_INITSZ >> 1)
;
-
do nsz <<= 1; while (nsz < rq
);
+ nsz =
b->sz + b->off
;
+
GROWBUF_SIZE(size_t, nsz, rq, DA_INITSZ, sz
);
/* --- Reallocate the block --- *
*
/* --- Reallocate the block --- *
*
@@
-219,8
+218,8
@@
void *da_shunt(da_base *b, void *v, size_t sz, size_t n)
* two which is big enough, starting at double the current size.
*/
* two which is big enough, starting at double the current size.
*/
- nsz =
v ? b->sz + b->off : (DA_INITSZ >> 1)
;
-
do nsz <<= 1; while (nsz < rq
);
+ nsz =
b->sz + b->off
;
+
GROWBUF_SIZE(size_t, nsz, rq, DA_INITSZ, sz
);
/* --- Reallocate the block --- *
*
/* --- Reallocate the block --- *
*