[Python-checkins] python/dist/src/Include asdl.h,1.1.2.5,1.1.2.6

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Tue Apr 13 10:57:33 EDT 2004


Update of /cvsroot/python/python/dist/src/Include
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16222/Include

Modified Files:
      Tag: ast-branch
	asdl.h 
Log Message:
ifdef logic was backwards, so debug versions of asdl seq ops were not
used with a debug build.

Fix macros to avoid unexpected variable capture and to avoid evaluating
index more than once.


Index: asdl.h
===================================================================
RCS file: /cvsroot/python/python/dist/src/Include/Attic/asdl.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** asdl.h	15 Sep 2003 00:25:07 -0000	1.1.2.5
--- asdl.h	13 Apr 2004 14:57:30 -0000	1.1.2.6
***************
*** 27,40 ****
  void asdl_seq_free(asdl_seq *);
  
- /* XXX: Normally should be Py_DEBUG, but asserts fail instantly at startup;
-         turned off for now */
- #define asdl_seq_GET(S, I) (S)->elements[(I)]
  #ifdef Py_DEBUG
! #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
! #define asdl_seq_APPEND(S, V) (S)->elements[(S)->offset++] = (V)
! #else
  #define asdl_seq_SET(S, I, V) { \
!         assert((S) && (I) < (S)->size); \
!         (S)->elements[I] = (V); \
  }
  #define asdl_seq_APPEND(S, V) { \
--- 27,36 ----
  void asdl_seq_free(asdl_seq *);
  
  #ifdef Py_DEBUG
! #define asdl_seq_GET(S, I) (S)->elements[(I)]
  #define asdl_seq_SET(S, I, V) { \
!         int _asdl_i = (I); \
!         assert((S) && _asdl_i < (S)->size); \
!         (S)->elements[_asdl_i] = (V); \
  }
  #define asdl_seq_APPEND(S, V) { \
***************
*** 42,45 ****
--- 38,45 ----
          (S)->elements[(S)->offset++] = (V); \
  }
+ #else
+ #define asdl_seq_GET(S, I) (S)->elements[(I)]
+ #define asdl_seq_SET(S, I, V) (S)->elements[I] = (V)
+ #define asdl_seq_APPEND(S, V) (S)->elements[(S)->offset++] = (V)
  #endif
  #define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size)




More information about the Python-checkins mailing list