From 77e40cd268e6ecd3597dd518f2e2a05d5a840e6e Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 14 Nov 2016 10:12:32 +0300 Subject: [PATCH] Replace C++ style comments to C ones, remove commented out code (extra) * extra/AmigaOS.c (GC_amiga_get_mem, GC_amiga_allocwrapper_any, GC_amiga_allocwrapper_fast): Replace the style of comments from C++ to C. * extra/MacOS.c (CodeZeroPtr, GC_MacTemporaryNewPtr): Likewise. * extra/Mac_files/MacOS_config.h: Likewise. * extra/AmigaOS.c (GC_amiga_get_mem, GC_amiga_rec_alloc, GC_amiga_allocwrapper_any, GC_amiga_allocwrapper_fast): Remove commented out code. * extra/Mac_files/MacOS_config.h: Likewise. --- extra/AmigaOS.c | 24 ++++++++---------------- extra/MacOS.c | 6 +++--- extra/Mac_files/MacOS_config.h | 15 +++++++-------- 3 files changed, 18 insertions(+), 27 deletions(-) diff --git a/extra/AmigaOS.c b/extra/AmigaOS.c index 07feb75b..dfe26af1 100644 --- a/extra/AmigaOS.c +++ b/extra/AmigaOS.c @@ -270,11 +270,10 @@ void *GC_amiga_get_mem(size_t size){ #ifndef GC_AMIGA_ONLYFAST if(GC_amiga_dontalloc==TRUE){ -// printf("rejected, size: %d, latestsize: %d\n",size,latestsize); return NULL; } - // We really don't want to use chip-mem, but if we must, then as little as possible. + /* We really don't want to use chip-mem, but if we must, then as little as possible. */ if(GC_AMIGA_MEMF==(MEMF_ANY|MEMF_CLEAR) && size>100000 && latestsize<50000) return NULL; #endif @@ -285,8 +284,6 @@ void *GC_amiga_get_mem(size_t size){ gc_am->size=size + sizeof(struct GC_Amiga_AllocedMemoryHeader); GC_AMIGAMEM=(struct GC_Amiga_AllocedMemoryHeader *)(~(int)(gc_am)); -// printf("Allocated %d (%d) bytes at address: %x. Latest: %d\n",size,tot,gc_am,latestsize); - #ifdef GC_AMIGA_PRINTSTATS if((char *)gc_am500000?9:size/5000))){ ret=GC_amiga_rec_alloc(size,AllocFunction,rec+1); -// GC_free(ret2); } return ret; @@ -357,14 +353,14 @@ void *GC_amiga_rec_alloc(size_t size,void *(*AllocFunction)(size_t size2),const void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2)){ void *ret; - GC_amiga_dontalloc=TRUE; // Pretty tough thing to do, but its indeed necessary. + GC_amiga_dontalloc=TRUE; /* Pretty tough thing to do, but its indeed necessary. */ latestsize=size; ret=(*AllocFunction)(size); if(((char *)ret) <= chipmax){ if(ret==NULL){ - //Give GC access to allocate memory. + /* Give GC access to allocate memory. */ #ifdef GC_AMIGA_GC if(!GC_dont_gc){ GC_gcollect(); @@ -394,7 +390,6 @@ void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2) /* We got chip-mem. Better try again and again and again etc., we might get fast-mem sooner or later... */ /* Using gctest to check the effectiveness of doing this, does seldom give a very good result. */ /* However, real programs doesn't normally rapidly allocate and deallocate. */ -// printf("trying to force... %d bytes... ",size); if( AllocFunction!=GC_malloc_uncollectable #ifdef GC_ATOMIC_UNCOLLECTABLE @@ -417,12 +412,10 @@ void *GC_amiga_allocwrapper_any(size_t size,void *(*AllocFunction)(size_t size2) #endif } if(((char *)ret2)>chipmax){ -// printf("Succeeded.\n"); GC_free(ret); ret=ret2; }else{ GC_free(ret2); -// printf("But did not succeed.\n"); } } #endif @@ -441,7 +434,7 @@ void GC_amiga_set_toany(void (*func)(void)){ GC_amiga_toany=func; } -#endif // !GC_AMIGA_ONLYFAST +#endif /* !GC_AMIGA_ONLYFAST */ void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2)){ @@ -450,8 +443,7 @@ void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2 ret=(*AllocFunction)(size); if(ret==NULL){ - // Enable chip-mem allocation. -// printf("ret==NULL\n"); + /* Enable chip-mem allocation. */ #ifdef GC_AMIGA_GC if(!GC_dont_gc){ GC_gcollect(); @@ -481,13 +473,13 @@ void *GC_amiga_allocwrapper_fast(size_t size,void *(*AllocFunction)(size_t size2 void *GC_amiga_allocwrapper_firsttime(size_t size,void *(*AllocFunction)(size_t size2)){ atexit(&GC_amiga_free_all_mem); - chipmax=(char *)SysBase->MaxLocMem; // For people still having SysBase in chip-mem, this might speed up a bit. + chipmax=(char *)SysBase->MaxLocMem; /* For people still having SysBase in chip-mem, this might speed up a bit. */ GC_amiga_allocwrapper_do=GC_amiga_allocwrapper_fast; return GC_amiga_allocwrapper_fast(size,AllocFunction); } -#endif //GC_AMIGA_FASTALLOC +#endif /* GC_AMIGA_FASTALLOC */ @@ -540,4 +532,4 @@ void *GC_amiga_realloc(void *old_object,size_t new_size_in_bytes){ #endif } -#endif //GC_AMIGA_AM +#endif /* GC_AMIGA_AM */ diff --git a/extra/MacOS.c b/extra/MacOS.c index ae0dd9f8..8dd9d8db 100644 --- a/extra/MacOS.c +++ b/extra/MacOS.c @@ -26,7 +26,7 @@ unloading shared library. #include "gc.h" #include "private/gc_priv.h" -// use 'CODE' resource 0 to get exact location of the beginning of global space. +/* use 'CODE' resource 0 to get exact location of the beginning of global space. */ typedef struct { unsigned long aboveA5; @@ -77,13 +77,13 @@ Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory) if (clearMemory) memset(tempPtr, 0, size); tempPtr = StripAddress(tempPtr); - // keep track of the allocated blocks. + /* keep track of the allocated blocks. */ (**tempMemBlock).nextBlock = theTemporaryMemory; theTemporaryMemory = tempMemBlock; } # if !defined(SHARED_LIBRARY_BUILD) - // install an exit routine to clean up the memory used at the end. + /* install an exit routine to clean up the memory used at the end. */ if (firstTime) { atexit(&GC_MacFreeTemporaryMemory); firstTime = false; diff --git a/extra/Mac_files/MacOS_config.h b/extra/Mac_files/MacOS_config.h index ec8f82c3..abbf9d8e 100644 --- a/extra/Mac_files/MacOS_config.h +++ b/extra/Mac_files/MacOS_config.h @@ -12,17 +12,16 @@ /* Boehm, November 17, 1995 12:10 pm PST */ #ifdef __MWERKS__ - -// for CodeWarrior Pro with Metrowerks Standard Library (MSL). -// #define MSL_USE_PRECOMPILED_HEADERS 0 +/* for CodeWarrior Pro with Metrowerks Standard Library (MSL). */ +/* #define MSL_USE_PRECOMPILED_HEADERS 0 */ #include #endif /* __MWERKS__ */ -// these are defined again in gc_priv.h. +/* these are defined again in gc_priv.h. */ #undef TRUE #undef FALSE -#define ALL_INTERIOR_POINTERS // follows interior pointers. -//#define DONT_ADD_BYTE_AT_END // no padding. -//#define SMALL_CONFIG // whether to use a smaller heap. -#define USE_TEMPORARY_MEMORY // use Macintosh temporary memory. +#define ALL_INTERIOR_POINTERS /* follows interior pointers. */ +/* #define DONT_ADD_BYTE_AT_END */ /* no padding. */ +/* #define SMALL_CONFIG */ /* whether to use a smaller heap. */ +#define USE_TEMPORARY_MEMORY /* use Macintosh temporary memory. */ -- 2.40.0