mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	
		
			
	
	
		
			19 lines
		
	
	
	
		
			402 B
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			19 lines
		
	
	
	
		
			402 B
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								#define _XOPEN_SOURCE 700
							 | 
						||
| 
								 | 
							
								#include <stdlib.h>
							 | 
						||
| 
								 | 
							
								#include <string.h>
							 | 
						||
| 
								 | 
							
								#include "sway/security.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								struct command_policy *alloc_command_policy(const char *command) {
							 | 
						||
| 
								 | 
							
									struct command_policy *policy = malloc(sizeof(struct command_policy));
							 | 
						||
| 
								 | 
							
									if (!policy) {
							 | 
						||
| 
								 | 
							
										return NULL;
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									policy->command = strdup(command);
							 | 
						||
| 
								 | 
							
									if (!policy->command) {
							 | 
						||
| 
								 | 
							
										free(policy);
							 | 
						||
| 
								 | 
							
										return NULL;
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									policy->context = 0;
							 | 
						||
| 
								 | 
							
									return policy;
							 | 
						||
| 
								 | 
							
								}
							 |