Previous 15994 Revisions Next

r9399 Saturday 16th October, 2010 at 18:00:34 UTC by Wilbert Pol
emuaaloc.h: Force inlining of MAME's new and delete operators.
[src/emu]emualloc.h

src/emu/emualloc.h
r9398r9399
204204//**************************************************************************
205205
206206// standard new/delete operators (try to avoid using)
207inline void *operator new(std::size_t size) throw (std::bad_alloc)
207ATTR_FORCE_INLINE inline void *operator new(std::size_t size) throw (std::bad_alloc)
208208{
209209   void *result = malloc_file_line(size, NULL, 0);
210210   if (result == NULL)
r9398r9399
212212   return result;
213213}
214214
215inline void *operator new[](std::size_t size) throw (std::bad_alloc)
215ATTR_FORCE_INLINE inline void *operator new[](std::size_t size) throw (std::bad_alloc)
216216{
217217   void *result = malloc_file_line(size, NULL, 0);
218218   if (result == NULL)
r9398r9399
220220   return result;
221221}
222222
223inline void operator delete(void *ptr) throw()
223ATTR_FORCE_INLINE inline void operator delete(void *ptr) throw()
224224{
225225   if (ptr != NULL)
226226      free_file_line(ptr, NULL, 0);
227227}
228228
229inline void operator delete[](void *ptr) throw()
229ATTR_FORCE_INLINE inline void operator delete[](void *ptr) throw()
230230{
231231   if (ptr != NULL)
232232      free_file_line(ptr, NULL, 0);
r9398r9399
234234
235235
236236// file/line new/delete operators
237inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc)
237ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc)
238238{
239239   void *result = malloc_file_line(size, file, line);
240240   if (result == NULL)
r9398r9399
242242   return result;
243243}
244244
245inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc)
245ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc)
246246{
247247   void *result = malloc_file_line(size, file, line);
248248   if (result == NULL)
r9398r9399
250250   return result;
251251}
252252
253inline void operator delete(void *ptr, const char *file, int line)
253ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line)
254254{
255255   if (ptr != NULL)
256256      free_file_line(ptr, file, line);
257257}
258258
259inline void operator delete[](void *ptr, const char *file, int line)
259ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line)
260260{
261261   if (ptr != NULL)
262262      free_file_line(ptr, file, line);
r9398r9399
264264
265265
266266// file/line new/delete operators with zeroing
267inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc)
267ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc)
268268{
269269   void *result = malloc_file_line(size, file, line);
270270   if (result == NULL)
r9398r9399
273273   return result;
274274}
275275
276inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc)
276ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc)
277277{
278278   void *result = malloc_file_line(size, file, line);
279279   if (result == NULL)
r9398r9399
282282   return result;
283283}
284284
285inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &)
285ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &)
286286{
287287   if (ptr != NULL)
288288      free_file_line(ptr, file, line);
289289}
290290
291inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &)
291ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &)
292292{
293293   if (ptr != NULL)
294294      free_file_line(ptr, file, line);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team