mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	Made all header files to have LABWC_ prefix in include guard identifers. Converted from __LABWC_ in 35 include/ files. Converted from __LAB_ in 5 include/ files. Added LABWC prefix to 3 include/ files. Added include guards to 3 include/ files. The double underscores were removed since according to C standard those "are always reserved for any use".
		
			
				
	
	
		
			42 lines
		
	
	
	
		
			756 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			756 B
		
	
	
	
		
			C
		
	
	
	
	
	
/* SPDX-License-Identifier: GPL-2.0-only */
 | 
						|
/*
 | 
						|
 * Very simple C string buffer implementation
 | 
						|
 *
 | 
						|
 * Copyright Johan Malm 2020
 | 
						|
 */
 | 
						|
 | 
						|
#ifndef LABWC_BUF_H
 | 
						|
#define LABWC_BUF_H
 | 
						|
 | 
						|
#include <stdio.h>
 | 
						|
#include <stdlib.h>
 | 
						|
#include <string.h>
 | 
						|
 | 
						|
struct buf {
 | 
						|
	char *buf;
 | 
						|
	int alloc;
 | 
						|
	int len;
 | 
						|
};
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_expand_shell_variables - expand $foo, ${foo} and ~ in buffer
 | 
						|
 * @s: buffer
 | 
						|
 * Note: $$ is not handled
 | 
						|
 */
 | 
						|
void buf_expand_shell_variables(struct buf *s);
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_init - allocate NULL-terminated C string buffer
 | 
						|
 * @s: buffer
 | 
						|
 * Note: use free(s->buf) to free it
 | 
						|
 */
 | 
						|
void buf_init(struct buf *s);
 | 
						|
 | 
						|
/**
 | 
						|
 * buf_add - add data to C string buffer
 | 
						|
 * @s: buffer
 | 
						|
 * @data: data to be added
 | 
						|
 */
 | 
						|
void buf_add(struct buf *s, const char *data);
 | 
						|
 | 
						|
#endif /* LABWC_BUF_H */
 |