include/: refactor header files more

This commit is contained in:
Johan Malm 2020-08-03 20:56:38 +01:00
parent 53266a0d5a
commit 4d1363dcae
32 changed files with 130 additions and 78 deletions

View file

@ -1,11 +1,11 @@
/*
* Very simple C buffer implementation
* Very simple C string buffer implementation
*
* Copyright Johan Malm 2020
*/
#ifndef BUF_H
#define BUF_H
#ifndef __LABWC_BUF_H
#define __LABWC_BUF_H
#include <stdio.h>
#include <stdlib.h>
@ -17,7 +17,18 @@ struct buf {
int len;
};
/*
* 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 /* BUF_H */
#endif /* __LABWC_BUF_H */

View file

@ -1,6 +1,10 @@
#ifndef __LABWC_BUG_ON_H
#define __LABWC_BUG_ON_H
/*
* BUG_ON - assert() without abort()
* @condition - expression to be evaluated
*/
#define BUG_ON(condition) \
do { \
if ((condition) != 0) { \
@ -9,5 +13,4 @@
} \
} while (0)
#endif /* __LABWC_BUT_ON_H */
#endif /* __LABWC_BUG_ON_H */

10
include/common/spawn.h Normal file
View file

@ -0,0 +1,10 @@
#ifndef __LABWC_SPAWN_H
#define __LABWC_SPAWN_H
/**
* spawn_async_no_shell - execute asyncronously
* @command: command to be executed
*/
void spawn_async_no_shell(char const *command);
#endif /* __LABWC_SPAWN_H */