mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			31 lines
		
	
	
	
		
			524 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			31 lines
		
	
	
	
		
			524 B
		
	
	
	
		
			C
		
	
	
	
	
	
#include <signal.h>
 | 
						|
#include <stdarg.h>
 | 
						|
#include <stdlib.h>
 | 
						|
#include "log.h"
 | 
						|
 | 
						|
void sway_terminate(int code);
 | 
						|
 | 
						|
void _sway_abort(const char *format, ...) {
 | 
						|
	va_list args;
 | 
						|
	va_start(args, format);
 | 
						|
	_wlr_vlog(L_ERROR, format, args);
 | 
						|
	va_end(args);
 | 
						|
	sway_terminate(EXIT_FAILURE);
 | 
						|
}
 | 
						|
 | 
						|
bool _sway_assert(bool condition, const char *format, ...) {
 | 
						|
	if (condition) {
 | 
						|
		return true;
 | 
						|
	}
 | 
						|
 | 
						|
	va_list args;
 | 
						|
	va_start(args, format);
 | 
						|
	_wlr_vlog(L_ERROR, format, args);
 | 
						|
	va_end(args);
 | 
						|
 | 
						|
#ifndef NDEBUG
 | 
						|
	raise(SIGABRT);
 | 
						|
#endif
 | 
						|
 | 
						|
	return false;
 | 
						|
}
 |