Commit Graph

16 Commits

Author SHA1 Message Date
Angus Salkeld
a5795f7d45 LOG: set the return code when calloc fails
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-11-23 10:24:56 +11:00
Angus Salkeld
5e955579cb array: add a mechanism to get a callback when a bin is allocated
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-10-23 10:31:47 +11:00
Angus Salkeld
35a4421d23 cleanup some warnings
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-05-31 22:18:04 +10:00
Angus Salkeld
d6883981e3 Fix some leaks in the logging.
Mainly for valgrind purposes.

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-27 16:42:38 +11:00
Angus Salkeld
4df255d919 Add locking to the array when growing.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-09 12:34:50 +11:00
Angus Salkeld
a9cdbbef8e ARRAY: cleanup the pointer sizeof()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-03-07 20:42:51 +11:00
Angus Salkeld
0d21be245b ARRAY: save memory (in the bins array) and allow holes in the array
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-02-22 17:30:19 +11:00
Angus Salkeld
5d8c96314e Allow the array to automatically grow.
this makes it a bit friendlier to use, as
the user will not have to call qb_array_grow().

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-04 21:40:03 +11:00
Yunkai Zhang
c8e97a1c2e Fixed bug: incorrect array length definition
When MAX_BINS is larger than MAX_BIN_ELEMENTS, this bug will cause
boudary overflow in qb_array_create function.

Signed-off-by: Yunkai Zhang <qiushu.zyk@taobao.com>
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-12-29 10:12:07 +11:00
Angus Salkeld
b2a0c06d50 ARRAY: make sure that num_bins stays below MAX_BINS
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-11-10 09:28:55 +11:00
Angus Salkeld
98493d9ae8 Change Lindent options to break the procedure type.
so change:
int foo(void)

to

int
foo(void)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-06-22 14:19:14 +10:00
Angus Salkeld
24107d56ef COV 8: don't leak mem when returning an error.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-05-20 21:31:29 +10:00
Angus Salkeld
4de5ff927f ARRAY: add getter's to retrieve number of bins and elms/bin
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-14 09:55:57 +10:00
Angus Salkeld
0d345d3ef1 ARRAY: return -ERANGE when index is out of range.
So you can differentiate the other errors (-EINVAL)

Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2011-04-13 11:23:00 +10:00
Angus Salkeld
7b2a0d3767 TEST: add some more array tests.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 21:16:47 +11:00
Angus Salkeld
9745d4feb7 Add a resizable array that doesn't move memory.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2010-10-19 07:05:54 +11:00