projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fb45f84
)
fold uci_file_cleanup into uci_cleanup
author
Felix Fietkau
<nbd@openwrt.org>
Tue, 12 Feb 2008 10:02:00 +0000
(11:02 +0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Tue, 12 Feb 2008 10:02:00 +0000
(11:02 +0100)
file.c
patch
|
blob
|
history
libuci.c
patch
|
blob
|
history
diff --git
a/file.c
b/file.c
index 553e5196355c165edb17adcf34df00d92efc6644..7049b3393d78f29dfc87efecbf22e964bf543c42 100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-30,26
+30,6
@@
*/
static void uci_file_cleanup(struct uci_context *ctx)
{
*/
static void uci_file_cleanup(struct uci_context *ctx)
{
- struct uci_parse_context *pctx;
-
- if (ctx->buf) {
- free(ctx->buf);
- ctx->buf = NULL;
- ctx->bufsz = 0;
- }
-
- pctx = ctx->pctx;
- if (!pctx)
- return;
-
- ctx->pctx = NULL;
- if (pctx->package)
- uci_free_package(&pctx->package);
-
- if (pctx->buf)
- free(pctx->buf);
-
- free(pctx);
}
}
diff --git
a/libuci.c
b/libuci.c
index 7805d746f01197582e2d7c453471616212a83394..118289b3eb77b72e6ac864b28e9dbdb5c7a93354 100644
(file)
--- a/
libuci.c
+++ b/
libuci.c
@@
-104,8
+104,28
@@
int uci_set_confdir(struct uci_context *ctx, const char *dir)
int uci_cleanup(struct uci_context *ctx)
{
int uci_cleanup(struct uci_context *ctx)
{
+ struct uci_parse_context *pctx;
UCI_HANDLE_ERR(ctx);
UCI_HANDLE_ERR(ctx);
- uci_file_cleanup(ctx);
+
+ if (ctx->buf) {
+ free(ctx->buf);
+ ctx->buf = NULL;
+ ctx->bufsz = 0;
+ }
+
+ pctx = ctx->pctx;
+ if (!pctx)
+ goto done;
+
+ ctx->pctx = NULL;
+ if (pctx->package)
+ uci_free_package(&pctx->package);
+
+ if (pctx->buf)
+ free(pctx->buf);
+
+ free(pctx);
+done:
return 0;
}
return 0;
}