[Python-checkins] CVS: python/dist/src/Objects obmalloc.c,2.3,2.4

Neil Schemenauer nascheme@users.sourceforge.net
Mon, 18 Mar 2002 13:06:23 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv31647/Objects

Modified Files:
	obmalloc.c 
Log Message:
Drop the PyCore_* memory API.


Index: obmalloc.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/obmalloc.c,v
retrieving revision 2.3
retrieving revision 2.4
diff -C2 -d -r2.3 -r2.4
*** obmalloc.c	18 Mar 2002 18:13:41 -0000	2.3
--- obmalloc.c	18 Mar 2002 21:06:21 -0000	2.4
***************
*** 350,354 ****
  
  void *
! _PyCore_ObjectMalloc(size_t nbytes)
  {
  	block *bp;
--- 350,354 ----
  
  void *
! _PyMalloc_Malloc(size_t nbytes)
  {
  	block *bp;
***************
*** 480,484 ****
  		 * per arena due to the required alignment on page boundaries.
  		 */
! 		bp = (block *)PyCore_MALLOC(ARENA_SIZE + SYSTEM_PAGE_SIZE);
  		if (bp == NULL) {
  			UNLOCK();
--- 480,484 ----
  		 * per arena due to the required alignment on page boundaries.
  		 */
! 		bp = (block *)PyMem_MALLOC(ARENA_SIZE + SYSTEM_PAGE_SIZE);
  		if (bp == NULL) {
  			UNLOCK();
***************
*** 511,515 ****
  	 * has been reached.
  	 */
! 	return (void *)PyCore_MALLOC(nbytes);
  }
  
--- 511,515 ----
  	 * has been reached.
  	 */
! 	return (void *)PyMem_MALLOC(nbytes);
  }
  
***************
*** 517,521 ****
  
  void
! _PyCore_ObjectFree(void *p)
  {
  	poolp pool;
--- 517,521 ----
  
  void
! _PyMalloc_Free(void *p)
  {
  	poolp pool;
***************
*** 537,541 ****
  	pool = (poolp )((block *)p - offset);
  	if (pool->pooladdr != pool || pool->magic != (uint )POOL_MAGIC) {
! 		PyCore_FREE(p);
  		return;
  	}
--- 537,541 ----
  	pool = (poolp )((block *)p - offset);
  	if (pool->pooladdr != pool || pool->magic != (uint )POOL_MAGIC) {
! 		PyMem_FREE(p);
  		return;
  	}
***************
*** 596,600 ****
  
  void *
! _PyCore_ObjectRealloc(void *p, size_t nbytes)
  {
  	block *bp;
--- 596,600 ----
  
  void *
! _PyMalloc_Realloc(void *p, size_t nbytes)
  {
  	block *bp;
***************
*** 608,612 ****
  
  	if (p == NULL)
! 		return _PyCore_ObjectMalloc(nbytes);
  
  	/* realloc(p, 0) on big blocks is redirected. */
--- 608,612 ----
  
  	if (p == NULL)
! 		return _PyMalloc_Malloc(nbytes);
  
  	/* realloc(p, 0) on big blocks is redirected. */
***************
*** 619,623 ****
  			goto malloc_copy_free;
  		}
! 		bp = (block *)PyCore_REALLOC(p, nbytes);
  	}
  	else {
--- 619,623 ----
  			goto malloc_copy_free;
  		}
! 		bp = (block *)PyMem_REALLOC(p, nbytes);
  	}
  	else {
***************
*** 628,632 ****
  			   except for realloc(p, 0) == free(p), ret NULL */
  			if (nbytes == 0) {
! 				_PyCore_ObjectFree(p);
  				bp = NULL;
  			}
--- 628,632 ----
  			   except for realloc(p, 0) == free(p), ret NULL */
  			if (nbytes == 0) {
! 				_PyMalloc_Free(p);
  				bp = NULL;
  			}
***************
*** 638,645 ****
  		malloc_copy_free:
  
! 			bp = (block *)_PyCore_ObjectMalloc(nbytes);
  			if (bp != NULL) {
  				memcpy(bp, p, size);
! 				_PyCore_ObjectFree(p);
  			}
  		}
--- 638,645 ----
  		malloc_copy_free:
  
! 			bp = (block *)_PyMalloc_Malloc(nbytes);
  			if (bp != NULL) {
  				memcpy(bp, p, size);
! 				_PyMalloc_Free(p);
  			}
  		}
***************
*** 652,656 ****
  /* -- unused --
  void *
! _PyCore_ObjectCalloc(size_t nbel, size_t elsz)
  {
          void *p;
--- 652,656 ----
  /* -- unused --
  void *
! _PyMalloc_Calloc(size_t nbel, size_t elsz)
  {
          void *p;
***************
*** 663,667 ****
  
  	nbytes = nbel * elsz;
! 	p = _PyCore_ObjectMalloc(nbytes);
  	if (p != NULL)
  		memset(p, 0, nbytes);
--- 663,667 ----
  
  	nbytes = nbel * elsz;
! 	p = _PyMalloc_Malloc(nbytes);
  	if (p != NULL)
  		memset(p, 0, nbytes);
***************
*** 679,686 ****
  
  void
! _PyCore_ObjectMalloc_SetHooks( void *(*malloc_func)(size_t),
! 			       void *(*calloc_func)(size_t, size_t),
! 			       void *(*realloc_func)(void *, size_t),
! 			       void (*free_func)(void *) )
  {
  	LOCK();
--- 679,686 ----
  
  void
! _PyMalloc_SetHooks( void *(*malloc_func)(size_t),
! 		    void *(*calloc_func)(size_t, size_t),
! 		    void *(*realloc_func)(void *, size_t),
! 		    void (*free_func)(void *) )
  {
  	LOCK();
***************
*** 693,700 ****
  
  void
! _PyCore_ObjectMalloc_FetchHooks( void *(**malloc_funcp)(size_t),
! 				 void *(**calloc_funcp)(size_t, size_t),
! 				 void *(**realloc_funcp)(void *, size_t),
! 				 void (**free_funcp)(void *) )
  {
  	LOCK();
--- 693,700 ----
  
  void
! _PyMalloc_FetchHooks( void *(**malloc_funcp)(size_t),
! 		      void *(**calloc_funcp)(size_t, size_t),
! 		      void *(**realloc_funcp)(void *, size_t),
! 		      void (**free_funcp)(void *) )
  {
  	LOCK();