17 lines
		
	
	
		
			340 B
		
	
	
	
		
			C
		
	
	
		
		
			
		
	
	
			17 lines
		
	
	
		
			340 B
		
	
	
	
		
			C
		
	
	
|  | #include "master.h"
 | ||
|  | 
 | ||
|  | /* If memory allocation fails, bail out */ | ||
|  | void *safe_malloc(size_t size) | ||
|  | { | ||
|  | 	void *ptr = malloc(size); | ||
|  | 	if(!ptr) fatal_error("Out of memory in safe_malloc", 0); | ||
|  | 	return ptr; | ||
|  | } | ||
|  | 
 | ||
|  | F_CHAR *safe_strdup(const F_CHAR *str) | ||
|  | { | ||
|  | 	F_CHAR *ptr = STRDUP(str); | ||
|  | 	if(!ptr) fatal_error("Out of memory in safe_strdup", 0); | ||
|  | 	return ptr; | ||
|  | } |