You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							17 lines
						
					
					
						
							491 B
						
					
					
				
			
		
		
	
	
							17 lines
						
					
					
						
							491 B
						
					
					
				#ifndef MALLOC_SAFE_H
 | 
						|
#define MALLOC_SAFE_H
 | 
						|
 | 
						|
/**
 | 
						|
 * Malloc that prints error and restarts the system on failure.
 | 
						|
 */
 | 
						|
 | 
						|
#include <stdlib.h>
 | 
						|
#include <stdint.h>
 | 
						|
 | 
						|
void *malloc_safe_do(size_t size, const char* file, uint32_t line);
 | 
						|
void *calloc_safe_do(size_t nmemb, size_t size, const char* file, uint32_t line);
 | 
						|
 | 
						|
#define malloc_s(size)        malloc_safe_do(size,        __FILE__, __LINE__)
 | 
						|
#define calloc_s(nmemb, size) calloc_safe_do(nmemb, size, __FILE__, __LINE__)
 | 
						|
 | 
						|
#endif // MALLOC_SAFE_H
 | 
						|
 |