[Complib] Fix bug in cl_vector_get to order of parameters for copy,
authorftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 14 Sep 2005 18:44:21 +0000 (18:44 +0000)
committerftillier <ftillier@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 14 Sep 2005 18:44:21 +0000 (18:44 +0000)
add state check assertions to cl_obj lock/unlock
Submitted by Yossi Leybovich <sleybo@mellanox.co.il>

git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@66 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

inc/complib/cl_obj.h
inc/complib/cl_vector.h

index fb9f2d1..34ba3dd 100644 (file)
@@ -699,6 +699,8 @@ CL_INLINE void CL_API
 cl_obj_lock(\r
        IN                              cl_obj_t * const                        p_obj )\r
 {\r
+       CL_ASSERT( p_obj->state == CL_INITIALIZED ||\r
+               p_obj->state == CL_DESTROYING );\r
        cl_spinlock_acquire( &p_obj->lock );\r
 }\r
 /*\r
@@ -727,6 +729,8 @@ CL_INLINE void CL_API
 cl_obj_unlock(\r
        IN                              cl_obj_t * const                        p_obj )\r
 {\r
+       CL_ASSERT( p_obj->state == CL_INITIALIZED ||\r
+               p_obj->state == CL_DESTROYING );\r
        cl_spinlock_release( &p_obj->lock );\r
 }\r
 /*\r
index fdaf41b..86dad3f 100644 (file)
@@ -625,7 +625,7 @@ cl_vector_get(
 \r
        /* Get a pointer to the element. */\r
        p_src = cl_vector_get_ptr( p_vector, index );\r
-       p_vector->pfn_copy( p_src, p_element, p_vector->element_size );\r
+       p_vector->pfn_copy( p_element, p_src, p_vector->element_size );\r
 }\r
 /*\r
 * PARAMETERS\r