From: <zu...@us...> - 2015-03-02 12:28:20
|
Revision: 5120 http://sourceforge.net/p/fuse-emulator/code/5120 Author: zubzero Date: 2015-03-02 12:28:08 +0000 (Mon, 02 Mar 2015) Log Message: ----------- Add libspectrum_{new,new0,renew}() macros Modified Paths: -------------- trunk/libspectrum/hacking/ChangeLog trunk/libspectrum/libspectrum.h.in Modified: trunk/libspectrum/hacking/ChangeLog =================================================================== --- trunk/libspectrum/hacking/ChangeLog 2015-03-02 12:17:38 UTC (rev 5119) +++ trunk/libspectrum/hacking/ChangeLog 2015-03-02 12:28:08 UTC (rev 5120) @@ -974,3 +974,4 @@ on pointer overflow in buffer length checks (Stuart). 20150302 internals.h,pzx_read.c,szx.c,test/test.c,zxs.c: add and use ARRAY_SIZE macro (Stuart). +20150302 libspectrum.h.in: add libspectrum_{new,new0,renew}() macros (Stuart). Modified: trunk/libspectrum/libspectrum.h.in =================================================================== --- trunk/libspectrum/libspectrum.h.in 2015-03-02 12:17:38 UTC (rev 5119) +++ trunk/libspectrum/libspectrum.h.in 2015-03-02 12:28:08 UTC (rev 5120) @@ -149,6 +149,15 @@ WIN32_DLL void libspectrum_mem_set_vtable( libspectrum_mem_vtable_t *table ); +#define libspectrum_new( type, count ) \ + ( ( type * ) libspectrum_malloc( sizeof( type ) * (count) ) ) + +#define libspectrum_new0( type, count ) \ + ( ( type * ) libspectrum_calloc( sizeof( type ), (count) ) ) + +#define libspectrum_renew( type, mem, count ) \ + ( ( type * ) libspectrum_realloc( (void *)mem, sizeof( type ) * (count) ) ) + /* Attempt to identify a given file */ /* Various types of file we might manage to identify */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |