Commit Graph

21 Commits

Author SHA1 Message Date
Chrissie Caulfield
b2acdea2a8
array: More locking fixes (#400)
* array: More locking fixes

helgrind threw out a couple more locking errors in the logging/array
code and we also need to protect a->max_elements
2020-06-08 14:16:58 +01:00
Ken Gaillot
aad74c7e39 array,log: Never set errno to a negative value
These are clearly a logical mistake due to the standard practice of returning
-errno on error, but errno itself should never be negative.
2019-07-26 09:39:58 +01:00
Ferenc Wágner
d90d45f576 doc: qbarray: reword comment about index partitioning 2019-05-07 14:46:02 +01:00
Jan Pokorný
fe7a40125f
warnings cleanup: Wsign-compare: array: int32_t -> size_t
Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2017-12-20 22:18:06 +01:00
Jan Pokorný
df3e266738
maint: array: avoid magic constants, expose some in the API
... also to make it the documentation refer to the implementation limits
properly.

When at it, also document some nits on the implementation side, unify
qbarray.h with project's doxygen conventions a bit + fix a typo there.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2017-12-20 22:17:45 +01:00
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