This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Change typed-vector iterator API


The typed vector iterator API was using the return value for two things
(a) the looping condition, and (b) the element pointer.  This turned out
to be wrong.
1) vectors of possibly NULL pointers cannot be iterated over (documented
restriction)
2) The loop overhead was poor - mostly vectors don't have null pointers
so we shouldn't check for them.

This patch changes the API to return the element pointer by an additional
pointer parameter.  Because the function is inlining, the addressof gunk
gets flattened, so there is no inefficiency in this interface.

Whilst doing the conversion, I uncovered some possibly buggy code in Mark's
conversion of g++'s METHOD_VEC, due to #1 above. Thus convincing me that
the older API is definitely wrong.

I've installed this patch after bootstrapping on i686-pc-linux-gnu.

nathan

--
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

Index: vec.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/vec.h,v
retrieving revision 2.11
diff -c -3 -p -r2.11 vec.h
*** vec.h	16 Jul 2004 01:15:30 -0000	2.11
--- vec.h	16 Jul 2004 08:53:25 -0000
*************** Software Foundation, 59 Temple Place - S
*** 112,118 ****
     T *VEC_T_last(VEC(T) *v); // Object
  
     Return the final element.  If V is empty,  abort.  */
! #define VEC_last(TDEF,V)		(VEC_OP(TDEF,last)(V))
  
  /* Index into vector
     T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
--- 112,118 ----
     T *VEC_T_last(VEC(T) *v); // Object
  
     Return the final element.  If V is empty,  abort.  */
! #define VEC_last(TDEF,V)		(VEC_OP(TDEF,last)(V VEC_CHECK_INFO))
  
  /* Index into vector
     T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 120,126 ****
  
     Return the IX'th element.  If IX is outside the domain of V,
     abort.  */
! #define VEC_index(TDEF,V,I)		(VEC_OP(TDEF,index)(V,I))
  
  /* Iterate over vector
     T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
--- 120,126 ----
  
     Return the IX'th element.  If IX is outside the domain of V,
     abort.  */
! #define VEC_index(TDEF,V,I)		(VEC_OP(TDEF,index)(V,I VEC_CHECK_INFO))
  
  /* Iterate over vector
     T VEC_T_index(VEC(T) *v, size_t ix); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 170,176 ****
     filled in. For object vectors, the new value can be NULL, in which
     case NO initialization is performed.  Aborts if there is
     insufficient space in the vector. */
! #define VEC_quick_push(TDEF,V,O)	(VEC_OP(TDEF,quick_push)(V,O))
  
  /* Push object with reallocation
     T *VEC_T_safe_push (VEC(T) *&v, T obj); // Pointer
--- 170,176 ----
     filled in. For object vectors, the new value can be NULL, in which
     case NO initialization is performed.  Aborts if there is
     insufficient space in the vector. */
! #define VEC_quick_push(TDEF,V,O)	(VEC_OP(TDEF,quick_push)(V,O VEC_CHECK_INFO))
  
  /* Push object with reallocation
     T *VEC_T_safe_push (VEC(T) *&v, T obj); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 179,185 ****
     Push a new element onto the end, returns a pointer to the slot
     filled in. For object vectors, the new value can be NULL, in which
     case NO initialization is performed.  Reallocates V, if needed.  */
! #define VEC_safe_push(TDEF,V,O)		(VEC_OP(TDEF,safe_push)(&(V),O MEM_STAT_INFO))
  
  /* Pop element off end
     T VEC_T_pop (VEC(T) *v);		// Pointer
--- 179,185 ----
     Push a new element onto the end, returns a pointer to the slot
     filled in. For object vectors, the new value can be NULL, in which
     case NO initialization is performed.  Reallocates V, if needed.  */
! #define VEC_safe_push(TDEF,V,O)		(VEC_OP(TDEF,safe_push)(&(V),O VEC_CHECK_INFO MEM_STAT_INFO))
  
  /* Pop element off end
     T VEC_T_pop (VEC(T) *v);		// Pointer
*************** Software Foundation, 59 Temple Place - S
*** 187,199 ****
  
     Pop the last element off the end. Returns the element popped, for
     pointer vectors.  */
! #define VEC_pop(TDEF,V)			(VEC_OP(TDEF,pop)(V))
  
  /* Truncate to specific length
     void VEC_T_truncate (VEC(T) *v, size_t len);
     
     Set the length as specified.  This is an O(1) operation.  */
! #define VEC_truncate(TDEF,V,I)		(VEC_OP(TDEF,truncate)(V,I))
  
  /* Replace element
     T VEC_T_replace (VEC(T) *v, size_t ix, T val); // Pointer
--- 187,199 ----
  
     Pop the last element off the end. Returns the element popped, for
     pointer vectors.  */
! #define VEC_pop(TDEF,V)			(VEC_OP(TDEF,pop)(V VEC_CHECK_INFO))
  
  /* Truncate to specific length
     void VEC_T_truncate (VEC(T) *v, size_t len);
     
     Set the length as specified.  This is an O(1) operation.  */
! #define VEC_truncate(TDEF,V,I)		(VEC_OP(TDEF,truncate)(V,I VEC_CHECK_INFO))
  
  /* Replace element
     T VEC_T_replace (VEC(T) *v, size_t ix, T val); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 204,210 ****
     pointer to the new value.  For object vectors the new value can be
     NULL, in which case no overwriting of the slot is actually
     performed.  */
! #define VEC_replace(TDEF,V,I,O)		(VEC_OP(TDEF,replace)(V,I,O))
  
  /* Insert object with no reallocation
     T *VEC_T_quick_insert (VEC(T) *v, size_t ix, T val); // Pointer
--- 204,210 ----
     pointer to the new value.  For object vectors the new value can be
     NULL, in which case no overwriting of the slot is actually
     performed.  */
! #define VEC_replace(TDEF,V,I,O)		(VEC_OP(TDEF,replace)(V,I,O VEC_CHECK_INFO))
  
  /* Insert object with no reallocation
     T *VEC_T_quick_insert (VEC(T) *v, size_t ix, T val); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 214,220 ****
     to the slot created.  For vectors of object, the new value can be
     NULL, in which case no initialization of the inserted slot takes
     place. Aborts if there is insufficient space.  */
! #define VEC_quick_insert(TDEF,V,I,O)	(VEC_OP(TDEF,quick_insert)(V,I,O))
  
  /* Insert object with reallocation
     T *VEC_T_safe_insert (VEC(T) *&v, size_t ix, T val); // Pointer
--- 214,220 ----
     to the slot created.  For vectors of object, the new value can be
     NULL, in which case no initialization of the inserted slot takes
     place. Aborts if there is insufficient space.  */
! #define VEC_quick_insert(TDEF,V,I,O)	(VEC_OP(TDEF,quick_insert)(V,I,O VEC_CHECK_INFO))
  
  /* Insert object with reallocation
     T *VEC_T_safe_insert (VEC(T) *&v, size_t ix, T val); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 224,230 ****
     to the slot created.  For vectors of object, the new value can be
     NULL, in which case no initialization of the inserted slot takes
     place. Reallocate V, if necessary.  */
! #define VEC_safe_insert(TDEF,V,I,O)	(VEC_OP(TDEF,safe_insert)(&(V),I,O MEM_STAT_INFO))
       
  /* Remove element retaining order
     T VEC_T_ordered_remove (VEC(T) *v, size_t ix); // Pointer
--- 224,230 ----
     to the slot created.  For vectors of object, the new value can be
     NULL, in which case no initialization of the inserted slot takes
     place. Reallocate V, if necessary.  */
! #define VEC_safe_insert(TDEF,V,I,O)	(VEC_OP(TDEF,safe_insert)(&(V),I,O VEC_CHECK_INFO MEM_STAT_INFO))
       
  /* Remove element retaining order
     T VEC_T_ordered_remove (VEC(T) *v, size_t ix); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 233,239 ****
     Remove an element from the IXth position of V. Ordering of
     remaining elements is preserverd.  For pointer vectors returns the
     removed object.  This is an O(N) operation due to a memmove.  */
! #define VEC_ordered_remove(TDEF,V,I)	(VEC_OP(TDEF,ordered_remove)(V,I))
  
  /* Remove element destroying order
     T VEC_T_unordered_remove (VEC(T) *v, size_t ix); // Pointer
--- 233,239 ----
     Remove an element from the IXth position of V. Ordering of
     remaining elements is preserverd.  For pointer vectors returns the
     removed object.  This is an O(N) operation due to a memmove.  */
! #define VEC_ordered_remove(TDEF,V,I)	(VEC_OP(TDEF,ordered_remove)(V,I VEC_CHECK_INFO))
  
  /* Remove element destroying order
     T VEC_T_unordered_remove (VEC(T) *v, size_t ix); // Pointer
*************** Software Foundation, 59 Temple Place - S
*** 242,248 ****
     Remove an element from the IXth position of V. Ordering of
     remaining elements is destroyed.  For pointer vectors returns the
     removed object.  This is an O(1) operation.  */
! #define VEC_unordered_remove(TDEF,V,I)	(VEC_OP(TDEF,unordered_remove)(V,I))
  
  /* Get the address of the array of elements
     T *VEC_T_address (VEC(T) v)
--- 242,255 ----
     Remove an element from the IXth position of V. Ordering of
     remaining elements is destroyed.  For pointer vectors returns the
     removed object.  This is an O(1) operation.  */
! #define VEC_unordered_remove(TDEF,V,I)	(VEC_OP(TDEF,unordered_remove)(V,I VEC_CHECK_INFO))
! 
! /* Get the address of the array of elements
!    T *VEC_T_address (VEC(T) v)
! 
!    If you need to directly manipulate the array (for instance, you
!    want to feed it to qsort), use this accessor.  */
! #define VEC_address(TDEF,V)		(VEC_OP(TDEF,address)(V))
  
  /* Get the address of the array of elements
     T *VEC_T_address (VEC(T) v)
*************** extern void *vec_p_reserve (void *, int 
*** 257,271 ****
  extern void *vec_o_reserve (void *, int, size_t, size_t MEM_STAT_DECL);
  
  #if ENABLE_CHECKING
! extern void vec_assert_fail (const char *, const char *,
! 			    const char *, unsigned int, const char *)
!      ATTRIBUTE_NORETURN;
! #define VEC_ASSERT_FAIL(OP,VEC) \
!   vec_assert_fail (OP,#VEC,__FILE__,__LINE__,__FUNCTION__)
       
  #define VEC_ASSERT(EXPR,OP,TDEF) \
    (void)((EXPR) ? 0 : (VEC_ASSERT_FAIL(OP,VEC(TDEF)), 0))
  #else
  #define VEC_ASSERT(EXPR,OP,TYPE) (void)(EXPR)
  #endif
  
--- 264,283 ----
  extern void *vec_o_reserve (void *, int, size_t, size_t MEM_STAT_DECL);
  
  #if ENABLE_CHECKING
! #define VEC_CHECK_INFO ,__FILE__,__LINE__,__FUNCTION__
! #define VEC_CHECK_DECL ,const char *file_,unsigned line_,const char *function_
! #define VEC_CHECK_PASS ,file_,line_,function_
       
  #define VEC_ASSERT(EXPR,OP,TDEF) \
    (void)((EXPR) ? 0 : (VEC_ASSERT_FAIL(OP,VEC(TDEF)), 0))
+ 
+ extern void vec_assert_fail (const char *, const char * VEC_CHECK_DECL)
+      ATTRIBUTE_NORETURN;
+ #define VEC_ASSERT_FAIL(OP,VEC) vec_assert_fail (OP,#VEC VEC_CHECK_PASS)
  #else
+ #define VEC_CHECK_INFO
+ #define VEC_CHECK_DECL
+ #define VEC_CHECK_PASS
  #define VEC_ASSERT(EXPR,OP,TYPE) (void)(EXPR)
  #endif
  
*************** static inline size_t VEC_OP (TDEF,length
*** 303,309 ****
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,last)					  \
!      (const VEC (TDEF) *vec_)						  \
  {									  \
    VEC_ASSERT (vec_ && vec_->num, "last", TDEF);				  \
    									  \
--- 315,321 ----
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,last)					  \
!      (const VEC (TDEF) *vec_ VEC_CHECK_DECL)				  \
  {									  \
    VEC_ASSERT (vec_ && vec_->num, "last", TDEF);				  \
    									  \
*************** static inline TDEF VEC_OP (TDEF,last)			
*** 311,317 ****
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,index)					  \
!      (const VEC (TDEF) *vec_, size_t ix_)				  \
  {									  \
    VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF);			  \
    									  \
--- 323,329 ----
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,index)					  \
!      (const VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)		  \
  {									  \
    VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF);			  \
    									  \
*************** static inline int VEC_OP (TDEF,reserve)	
*** 356,362 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_push)				  \
!      (VEC (TDEF) *vec_, TDEF obj_)					  \
  {									  \
    TDEF *slot_;								  \
    									  \
--- 368,374 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_push)				  \
!      (VEC (TDEF) *vec_, TDEF obj_ VEC_CHECK_DECL)			  \
  {									  \
    TDEF *slot_;								  \
    									  \
*************** static inline TDEF *VEC_OP (TDEF,quick_p
*** 368,382 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_push)				  \
!      (VEC (TDEF) **vec_, TDEF obj_ MEM_STAT_DECL)			  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_push) (*vec_, obj_);			  \
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,pop)					  \
!      (VEC (TDEF) *vec_)			       				  \
  {									  \
    TDEF obj_;								  \
  									  \
--- 380,394 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_push)				  \
!      (VEC (TDEF) **vec_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL)       	  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS);		  \
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,pop)					  \
!      (VEC (TDEF) *vec_ VEC_CHECK_DECL)	    				  \
  {									  \
    TDEF obj_;								  \
  									  \
*************** static inline TDEF VEC_OP (TDEF,pop)				
*** 387,393 ****
  }									  \
  									  \
  static inline void VEC_OP (TDEF,truncate)				  \
!      (VEC (TDEF) *vec_, size_t size_)					  \
  {									  \
    VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF);	  \
    if (vec_)								  \
--- 399,405 ----
  }									  \
  									  \
  static inline void VEC_OP (TDEF,truncate)				  \
!      (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL)			  \
  {									  \
    VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF);	  \
    if (vec_)								  \
*************** static inline void VEC_OP (TDEF,truncate
*** 395,401 ****
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,replace)		  	     	  \
!      (VEC (TDEF) *vec_, size_t ix_, TDEF obj_)				  \
  {									  \
    TDEF old_obj_;							  \
  									  \
--- 407,413 ----
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,replace)		  	     	  \
!      (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL)		  \
  {									  \
    TDEF old_obj_;							  \
  									  \
*************** static inline TDEF VEC_OP (TDEF,replace)
*** 407,413 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_insert)		     	  	  \
!      (VEC (TDEF) *vec_, size_t ix_, TDEF obj_)				  \
  {									  \
    TDEF *slot_;								  \
  									  \
--- 419,425 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_insert)		     	  	  \
!      (VEC (TDEF) *vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL)		  \
  {									  \
    TDEF *slot_;								  \
  									  \
*************** static inline TDEF *VEC_OP (TDEF,quick_i
*** 421,435 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_insert)		     	  	  \
!      (VEC (TDEF) **vec_, size_t ix_, TDEF obj_ MEM_STAT_DECL)		  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_);			  \
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,ordered_remove)				  \
!      (VEC (TDEF) *vec_, size_t ix_)					  \
  {									  \
    TDEF *slot_;								  \
    TDEF obj_;								  \
--- 433,447 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_insert)		     	  	  \
!      (VEC (TDEF) **vec_, size_t ix_, TDEF obj_ VEC_CHECK_DECL MEM_STAT_DECL) \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS);	  \
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,ordered_remove)				  \
!      (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)			  \
  {									  \
    TDEF *slot_;								  \
    TDEF obj_;								  \
*************** static inline TDEF VEC_OP (TDEF,ordered_
*** 443,449 ****
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,unordered_remove)			  \
!      (VEC (TDEF) *vec_, size_t ix_)					  \
  {									  \
    TDEF *slot_;								  \
    TDEF obj_;								  \
--- 455,461 ----
  }									  \
  									  \
  static inline TDEF VEC_OP (TDEF,unordered_remove)			  \
!      (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)			  \
  {									  \
    TDEF *slot_;								  \
    TDEF obj_;								  \
*************** static inline size_t VEC_OP (TDEF,length
*** 480,486 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,last)					  \
!      (VEC (TDEF) *vec_)							  \
  {									  \
    VEC_ASSERT (vec_ && vec_->num, "last", TDEF);				  \
    									  \
--- 492,498 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,last)					  \
!      (VEC (TDEF) *vec_ VEC_CHECK_DECL)					  \
  {									  \
    VEC_ASSERT (vec_ && vec_->num, "last", TDEF);				  \
    									  \
*************** static inline TDEF *VEC_OP (TDEF,last)		
*** 488,494 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,index)					  \
!      (VEC (TDEF) *vec_, size_t ix_)					  \
  {									  \
    VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF);			  \
    									  \
--- 500,506 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,index)					  \
!      (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)			  \
  {									  \
    VEC_ASSERT (vec_ && ix_ < vec_->num, "index", TDEF);			  \
    									  \
*************** static inline int VEC_OP (TDEF,reserve)	
*** 537,543 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_push)				  \
!      (VEC (TDEF) *vec_, const TDEF *obj_)				  \
  {									  \
    TDEF *slot_;								  \
    									  \
--- 549,555 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_push)				  \
!      (VEC (TDEF) *vec_, const TDEF *obj_ VEC_CHECK_DECL)		  \
  {									  \
    TDEF *slot_;								  \
    									  \
*************** static inline TDEF *VEC_OP (TDEF,quick_p
*** 550,571 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_push)				  \
!      (VEC (TDEF) **vec_, const TDEF *obj_ MEM_STAT_DECL)		  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_push) (*vec_, obj_);			  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,pop)					  \
!      (VEC (TDEF) *vec_)							  \
  {									  \
    VEC_ASSERT (vec_->num, "pop", TDEF);					  \
    --vec_->num;								  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,truncate)				  \
!      (VEC (TDEF) *vec_, size_t size_)					  \
  {									  \
    VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF);	  \
    if (vec_)								  \
--- 562,583 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_push)				  \
!      (VEC (TDEF) **vec_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL)   \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_push) (*vec_, obj_ VEC_CHECK_PASS);		  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,pop)					  \
!      (VEC (TDEF) *vec_ VEC_CHECK_DECL)					  \
  {									  \
    VEC_ASSERT (vec_->num, "pop", TDEF);					  \
    --vec_->num;								  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,truncate)				  \
!      (VEC (TDEF) *vec_, size_t size_ VEC_CHECK_DECL)			  \
  {									  \
    VEC_ASSERT (vec_ ? vec_->num >= size_ : !size_, "truncate", TDEF);	  \
    if (vec_)								  \
*************** static inline void VEC_OP (TDEF,truncate
*** 573,579 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,replace)				  \
!      (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_)			  \
  {									  \
    TDEF *slot_;								  \
  									  \
--- 585,591 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,replace)				  \
!      (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL)	  \
  {									  \
    TDEF *slot_;								  \
  									  \
*************** static inline TDEF *VEC_OP (TDEF,replace
*** 586,592 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_insert)				  \
!      (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_)			  \
  {									  \
    TDEF *slot_;								  \
  									  \
--- 598,604 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,quick_insert)				  \
!      (VEC (TDEF) *vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL)	  \
  {									  \
    TDEF *slot_;								  \
  									  \
*************** static inline TDEF *VEC_OP (TDEF,quick_i
*** 601,615 ****
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_insert)		     	  	  \
!      (VEC (TDEF) **vec_, size_t ix_, const TDEF *obj_ MEM_STAT_DECL)	  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_);			  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,ordered_remove)				  \
!      (VEC (TDEF) *vec_, size_t ix_)					  \
  {									  \
    TDEF *slot_;								  \
  									  \
--- 613,627 ----
  }									  \
  									  \
  static inline TDEF *VEC_OP (TDEF,safe_insert)		     	  	  \
!      (VEC (TDEF) **vec_, size_t ix_, const TDEF *obj_ VEC_CHECK_DECL MEM_STAT_DECL)  \
  {									  \
    VEC_OP (TDEF,reserve) (vec_, -1 PASS_MEM_STAT);			  \
  									  \
!   return VEC_OP (TDEF,quick_insert) (*vec_, ix_, obj_ VEC_CHECK_PASS);	  \
  }									  \
  									  \
  static inline void VEC_OP (TDEF,ordered_remove)				  \
!      (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)			  \
  {									  \
    TDEF *slot_;								  \
  									  \
*************** static inline void VEC_OP (TDEF,ordered_
*** 619,625 ****
  }									  \
  									  \
  static inline void VEC_OP (TDEF,unordered_remove)			  \
!      (VEC (TDEF) *vec_, size_t ix_)					  \
  {									  \
    VEC_ASSERT (ix_ < vec_->num, "remove", TDEF);				  \
    vec_->vec[ix_] = vec_->vec[--vec_->num];				  \
--- 631,637 ----
  }									  \
  									  \
  static inline void VEC_OP (TDEF,unordered_remove)			  \
!      (VEC (TDEF) *vec_, size_t ix_ VEC_CHECK_DECL)			  \
  {									  \
    VEC_ASSERT (ix_ < vec_->num, "remove", TDEF);				  \
    vec_->vec[ix_] = vec_->vec[--vec_->num];				  \

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]