src/config/rcxml.c: parse xml from buffer

Avoid unit tests writing to/from files by using xmlParseMemory() instead
of xmlReadFile().
This commit is contained in:
Johan Malm 2020-06-09 21:40:46 +01:00
parent 40c0b169ef
commit bc51e0ad2f
10 changed files with 86 additions and 9 deletions

23
include/buf.h Normal file
View file

@ -0,0 +1,23 @@
/*
* Very simple C buffer implementation
*
* Copyright Johan Malm 2020
*/
#ifndef BUF_H
#define BUF_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct buf {
char *buf;
int alloc;
int len;
};
void buf_init(struct buf *s);
void buf_add(struct buf *s, const char *data);
#endif /* BUF_H */

View file

@ -4,6 +4,8 @@
#include <stdio.h>
#include <stdbool.h>
#include "buf.h"
struct rcxml {
bool client_side_decorations;
};
@ -11,6 +13,7 @@ struct rcxml {
extern struct rcxml rc;
void rcxml_init(struct rcxml *rc);
void rcxml_parse_xml(struct buf *b);
void rcxml_read(const char *filename);
void rcxml_set_verbose(void);