WARN and FATAL macros
This commit is contained in:
		
							
								
								
									
										18
									
								
								sxiv.h
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								sxiv.h
									
									
									
									
									
								
							@@ -23,4 +23,22 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#define VERSION "git-20110117"
 | 
					#define VERSION "git-20110117"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define WARN(...)                                                  \
 | 
				
			||||||
 | 
						do {                                                             \
 | 
				
			||||||
 | 
						  fprintf(stderr, "sxiv: %s:%d: warning: ", __FILE__, __LINE__); \
 | 
				
			||||||
 | 
							fprintf(stderr, __VA_ARGS__);                                  \
 | 
				
			||||||
 | 
							fprintf(stderr, "\n");                                         \
 | 
				
			||||||
 | 
						} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define FATAL(...)                                                 \
 | 
				
			||||||
 | 
					  do {                                                             \
 | 
				
			||||||
 | 
							fprintf(stderr, "sxiv: %s:%d: error: ", __FILE__, __LINE__);   \
 | 
				
			||||||
 | 
							fprintf(stderr, __VA_ARGS__);                                  \
 | 
				
			||||||
 | 
							fprintf(stderr, "\n");                                         \
 | 
				
			||||||
 | 
							cleanup();                                                     \
 | 
				
			||||||
 | 
							exit(1);                                                       \
 | 
				
			||||||
 | 
						} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void cleanup();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* SXIV_H */
 | 
					#endif /* SXIV_H */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user