In the macro OSRF_LIST_GET_INDEX: placed all occurrences of the macro arguments
authorscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 11 Jan 2009 22:11:34 +0000 (22:11 +0000)
committerscottmk <scottmk@9efc2488-bf62-4759-914b-345cdb29e865>
Sun, 11 Jan 2009 22:11:34 +0000 (22:11 +0000)
in parentheses, to prevent unexpected effects when one or more of the
arguments is an expression.

git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1616 9efc2488-bf62-4759-914b-345cdb29e865

include/opensrf/osrf_list.h

index 35ec116..aeaf357 100644 (file)
@@ -7,7 +7,7 @@
 extern "C" {
 #endif
 
-#define OSRF_LIST_GET_INDEX(l, i) (!l || i >= l->size) ? NULL: l->arrlist[i]
+#define OSRF_LIST_GET_INDEX(l, i) (!(l) || (i) >= (l)->size) ? NULL: (l)->arrlist[(i)]
 
 /**
   Items are stored as void*'s so it's up to the user to