[Nagios-checkins] SF.net SVN: nagios:[2127] nagioscore/trunk/lib/bitmap.c
Nagios network monitoring software is enterprise server monitoring
Brought to you by:
egalstad,
sawolf-nagios
From: <ag...@us...> - 2012-09-02 08:33:57
|
Revision: 2127 http://nagios.svn.sourceforge.net/nagios/?rev=2127&view=rev Author: ageric Date: 2012-09-02 08:33:51 +0000 (Sun, 02 Sep 2012) Log Message: ----------- lib/bitmap: Allow unions between one set and the empty set Previously we required two valid bitmaps to be passed to bitmap_union and bitmap_unite, but taking the union of a set and the empty (NULL) set is a valid operation that yields "the other" set. unioning two empty sets ofcourse yields the empty set, so we're covered from all angles. Signed-off-by: Andreas Ericsson <ae...@op...> Modified Paths: -------------- nagioscore/trunk/lib/bitmap.c Modified: nagioscore/trunk/lib/bitmap.c =================================================================== --- nagioscore/trunk/lib/bitmap.c 2012-08-29 15:20:51 UTC (rev 2126) +++ nagioscore/trunk/lib/bitmap.c 2012-09-02 08:33:51 UTC (rev 2127) @@ -235,6 +235,11 @@ bitmap *bitmap_union(const bitmap *a, const bitmap *b) { + if(!a) + return bitmap_copy(b); + if(!b) + return bitmap_copy(a); + BITMAP_MATH(a, b) { bm->vector[i] = a->vector[i] | b->vector[i]; } @@ -246,6 +251,9 @@ { unsigned int i; + if(!addme || !res) + return res; + if (bitmap_size(addme) > bitmap_size(res)) { bitmap_resize(res, bitmap_size(addme)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |