$(1).static.o: $(2)
endef
-SOURCES = libuci.c file.c ucimap.c util.c
+SOURCES = libuci.c file.c ucimap.c util.c delta.c
all: uci libuci.$(SHLIB_EXT) uci-static ucimap-example
-$(eval $(call add_dep,libuci,delta.c list.c uci.h uci_config.h uci_internal.h))
+$(eval $(call add_dep,libuci,list.c uci.h uci_config.h uci_internal.h))
$(eval $(call add_dep,ucimap,uci.h uci_config.h ucimap.h))
cli.o: cli.c uci.h uci_config.h
#include <fcntl.h>
#include <stdio.h>
#include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "uci.h"
+#include "uci_internal.h"
/* record a change that was done to a package */
void
switch(cmd) {
case UCI_CMD_REORDER:
- expand_ptr(ctx, &ptr, true);
+ uci_expand_ptr(ctx, &ptr, true);
if (!ptr.s)
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
UCI_INTERNAL(uci_reorder_section, ctx, ptr.s, strtoul(ptr.value, NULL, 10));
char *option = NULL;
UCI_HANDLE_ERR(ctx);
- expand_ptr(ctx, ptr, false);
+ uci_expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->p->has_delta);
/*
#include <glob.h>
#include "uci.h"
-static const char *uci_confdir = UCI_CONFDIR;
-static const char *uci_savedir = UCI_SAVEDIR;
-
static const char *uci_errstr[] = {
[UCI_OK] = "Success",
[UCI_ERR_MEM] = "Out of memory",
#include "uci_internal.h"
#include "list.c"
-#include "delta.c"
+
+__private const char *uci_confdir = UCI_CONFDIR;
+__private const char *uci_savedir = UCI_SAVEDIR;
/* exported functions */
struct uci_context *uci_alloc_context(void)
* uci_alloc_generic allocates a new uci_element with payload
* payload is appended to the struct to save memory and reduce fragmentation
*/
-static struct uci_element *
+__private struct uci_element *
uci_alloc_generic(struct uci_context *ctx, int type, const char *name, int size)
{
struct uci_element *e;
return e;
}
-static void
+__private void
uci_free_element(struct uci_element *e)
{
if (e->name)
return 0;
}
-static struct uci_element *
-expand_ptr(struct uci_context *ctx, struct uci_ptr *ptr, bool complete)
+__private struct uci_element *
+uci_expand_ptr(struct uci_context *ctx, struct uci_ptr *ptr, bool complete)
{
UCI_ASSERT(ctx, ptr != NULL);
UCI_HANDLE_ERR(ctx);
- e = expand_ptr(ctx, ptr, true);
+ e = uci_expand_ptr(ctx, ptr, true);
p = ptr->p;
UCI_ASSERT(ctx, ptr->s);
UCI_HANDLE_ERR(ctx);
- e = expand_ptr(ctx, ptr, true);
+ e = uci_expand_ptr(ctx, ptr, true);
p = ptr->p;
UCI_ASSERT(ctx, ptr->s);
UCI_HANDLE_ERR(ctx);
- expand_ptr(ctx, ptr, false);
+ uci_expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->s);
UCI_ASSERT(ctx, ptr->value);
bool internal = ctx->internal;
UCI_HANDLE_ERR(ctx);
- expand_ptr(ctx, ptr, false);
+ uci_expand_ptr(ctx, ptr, false);
UCI_ASSERT(ctx, ptr->value);
UCI_ASSERT(ctx, ptr->s || (!ptr->option && ptr->section));
if (!ptr->option && ptr->value[0]) {
int bufsz;
};
+extern const char *uci_confdir;
+extern const char *uci_savedir;
+
__plugin void *uci_malloc(struct uci_context *ctx, size_t size);
__plugin void *uci_realloc(struct uci_context *ctx, void *ptr, size_t size);
__plugin char *uci_strdup(struct uci_context *ctx, const char *str);
__private struct uci_element *uci_lookup_list(struct uci_list *list, const char *name);
__private void uci_fixup_section(struct uci_context *ctx, struct uci_section *s);
__private void uci_free_package(struct uci_package **package);
+__private struct uci_element *uci_alloc_generic(struct uci_context *ctx, int type, const char *name, int size);
+__private void uci_free_element(struct uci_element *e);
+__private struct uci_element *uci_expand_ptr(struct uci_context *ctx, struct uci_ptr *ptr, bool complete);
__private int uci_load_delta(struct uci_context *ctx, struct uci_package *p, bool flush);