M7350v1_en_gpl

This commit is contained in:
T
2024-09-09 08:52:07 +00:00
commit f9cc65cfda
65988 changed files with 26357421 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
diff --git a/delta.c b/delta.c
index 73c2728..3438081 100644
--- a/delta.c
+++ b/delta.c
@@ -398,6 +398,73 @@ error:
return 0;
}
+void uci_reparse_delta_file(struct uci_context* ctx, FILE* f)
+{
+ struct uci_parse_context *pctx;
+ struct uci_element *e, *tmp;
+ struct uci_list list;
+
+ uci_list_init(&list);
+ uci_alloc_parse_context(ctx);
+ pctx = ctx->pctx;
+
+ fflush(f);
+ rewind(f);
+
+ UCI_TRAP_SAVE(ctx, done);
+
+ pctx->file = f;
+ while (!feof(f)) {
+ struct uci_element *e;
+ struct uci_element *pe;
+ char *buf;
+ char* pstr = NULL;
+
+ uci_getln(ctx, 0);
+ buf = pctx->buf;
+ if (!buf[0])
+ continue;
+
+ e = uci_alloc_generic(ctx, UCI_TYPE_DELTA, pctx->buf, sizeof(struct uci_element));
+ uci_foreach_element_safe(&list, tmp, pe) {
+ pstr = NULL;
+ pstr = strchr(e->name, '=');
+ int len = -1;
+ if (pstr)
+ {
+ len = pstr - e->name;
+ }
+ else
+ {
+ len = strlen(e->name);
+ }
+
+ if (! strncmp(e->name, pe->name, len))
+ {
+ uci_free_element(pe);
+ }
+ }
+ uci_list_add(&list, &e->list);
+ }
+
+ /* rebuild the delta file */
+ rewind(f);
+ if (ftruncate(fileno(f), 0) < 0)
+ UCI_THROW(ctx, UCI_ERR_IO);
+ uci_foreach_element_safe(&list, tmp, e) {
+ fprintf(f, "%s\n", e->name);
+ uci_free_element(e);
+ }
+
+ UCI_TRAP_RESTORE(ctx);
+done:
+ uci_foreach_element_safe(&list, tmp, e) {
+ uci_free_element(e);
+ }
+ uci_cleanup(ctx);
+
+}
+
int uci_save(struct uci_context *ctx, struct uci_package *p)
{
FILE *f = NULL;
@@ -476,6 +543,7 @@ int uci_save(struct uci_context *ctx, struct uci_package *p)
uci_free_delta(h);
}
+ uci_reparse_delta_file(ctx, f);
done:
uci_close_stream(f);
free(filename);

View File

@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f9decc6..53eece9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,8 @@ TARGET_LINK_LIBRARIES(cli uci)
ADD_LIBRARY(ucimap STATIC ucimap.c)
-ADD_SUBDIRECTORY(lua)
+#[zhoulichao] unsupport lua
+#ADD_SUBDIRECTORY(lua)
INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h
DESTINATION include