Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
multipath-tools
multipath-tools-check-vector-defines
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File multipath-tools-check-vector-defines of Package multipath-tools
commit 03b42661495abdb9fa594ff82105f705d2c4148f Author: Hannes Reinecke <hare@suse.de> Date: Mon Jan 26 13:01:33 2009 +0100 Error checking for VECTOR_XXX defines Christophe doesn't believe in error checking. I, however, have been tripping over them all the time. References: bnc#469269 Signed-off-by: Hannes Reinecke <hare@suse.de> diff --git a/libmultipath/vector.h b/libmultipath/vector.h index aa9e134..59cfd27 100644 --- a/libmultipath/vector.h +++ b/libmultipath/vector.h @@ -31,9 +31,9 @@ struct _vector { typedef struct _vector *vector; #define VECTOR_DEFAULT_SIZE 1 -#define VECTOR_SLOT(V,E) ((V)->slot[(E)]) -#define VECTOR_SIZE(V) ((V)->allocated) -#define VECTOR_LAST_SLOT(V) ((V)->slot[((V)->allocated - 1)]) +#define VECTOR_SLOT(V,E) (((V) && (E) < (V)->allocated) ? (V)->slot[(E)] : NULL) +#define VECTOR_SIZE(V) ((V) ? (V)->allocated : 0) +#define VECTOR_LAST_SLOT(V) (((V) && (V)->allocated) ? (V)->slot[((V)->allocated - 1)] : NULL) #define vector_foreach_slot(v,p,i) \ for (i = 0; (v) && i < (v)->allocated && ((p) = (v)->slot[i]); i++)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor