src/emu/emualloc.h
| r9398 | r9399 | |
| 204 | 204 | //************************************************************************** |
| 205 | 205 | |
| 206 | 206 | // standard new/delete operators (try to avoid using) |
| 207 | | inline void *operator new(std::size_t size) throw (std::bad_alloc) |
| 207 | ATTR_FORCE_INLINE inline void *operator new(std::size_t size) throw (std::bad_alloc) |
| 208 | 208 | { |
| 209 | 209 | void *result = malloc_file_line(size, NULL, 0); |
| 210 | 210 | if (result == NULL) |
| r9398 | r9399 | |
| 212 | 212 | return result; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | | inline void *operator new[](std::size_t size) throw (std::bad_alloc) |
| 215 | ATTR_FORCE_INLINE inline void *operator new[](std::size_t size) throw (std::bad_alloc) |
| 216 | 216 | { |
| 217 | 217 | void *result = malloc_file_line(size, NULL, 0); |
| 218 | 218 | if (result == NULL) |
| r9398 | r9399 | |
| 220 | 220 | return result; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | | inline void operator delete(void *ptr) throw() |
| 223 | ATTR_FORCE_INLINE inline void operator delete(void *ptr) throw() |
| 224 | 224 | { |
| 225 | 225 | if (ptr != NULL) |
| 226 | 226 | free_file_line(ptr, NULL, 0); |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | | inline void operator delete[](void *ptr) throw() |
| 229 | ATTR_FORCE_INLINE inline void operator delete[](void *ptr) throw() |
| 230 | 230 | { |
| 231 | 231 | if (ptr != NULL) |
| 232 | 232 | free_file_line(ptr, NULL, 0); |
| r9398 | r9399 | |
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | // file/line new/delete operators |
| 237 | | inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) |
| 237 | ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line) throw (std::bad_alloc) |
| 238 | 238 | { |
| 239 | 239 | void *result = malloc_file_line(size, file, line); |
| 240 | 240 | if (result == NULL) |
| r9398 | r9399 | |
| 242 | 242 | return result; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | | inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) |
| 245 | ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line) throw (std::bad_alloc) |
| 246 | 246 | { |
| 247 | 247 | void *result = malloc_file_line(size, file, line); |
| 248 | 248 | if (result == NULL) |
| r9398 | r9399 | |
| 250 | 250 | return result; |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | | inline void operator delete(void *ptr, const char *file, int line) |
| 253 | ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line) |
| 254 | 254 | { |
| 255 | 255 | if (ptr != NULL) |
| 256 | 256 | free_file_line(ptr, file, line); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | | inline void operator delete[](void *ptr, const char *file, int line) |
| 259 | ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line) |
| 260 | 260 | { |
| 261 | 261 | if (ptr != NULL) |
| 262 | 262 | free_file_line(ptr, file, line); |
| r9398 | r9399 | |
| 264 | 264 | |
| 265 | 265 | |
| 266 | 266 | // file/line new/delete operators with zeroing |
| 267 | | inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) |
| 267 | ATTR_FORCE_INLINE inline void *operator new(std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) |
| 268 | 268 | { |
| 269 | 269 | void *result = malloc_file_line(size, file, line); |
| 270 | 270 | if (result == NULL) |
| r9398 | r9399 | |
| 273 | 273 | return result; |
| 274 | 274 | } |
| 275 | 275 | |
| 276 | | inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) |
| 276 | ATTR_FORCE_INLINE inline void *operator new[](std::size_t size, const char *file, int line, const zeromem_t &) throw (std::bad_alloc) |
| 277 | 277 | { |
| 278 | 278 | void *result = malloc_file_line(size, file, line); |
| 279 | 279 | if (result == NULL) |
| r9398 | r9399 | |
| 282 | 282 | return result; |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | | inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &) |
| 285 | ATTR_FORCE_INLINE inline void operator delete(void *ptr, const char *file, int line, const zeromem_t &) |
| 286 | 286 | { |
| 287 | 287 | if (ptr != NULL) |
| 288 | 288 | free_file_line(ptr, file, line); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | | inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) |
| 291 | ATTR_FORCE_INLINE inline void operator delete[](void *ptr, const char *file, int line, const zeromem_t &) |
| 292 | 292 | { |
| 293 | 293 | if (ptr != NULL) |
| 294 | 294 | free_file_line(ptr, file, line); |