projects
/
project
/
ubus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ubus: Remove unnecessary memset calls.
[project/ubus.git]
/
libubus.c
diff --git
a/libubus.c
b/libubus.c
index
d52faff
..
260e40f
100644
(file)
--- a/
libubus.c
+++ b/
libubus.c
@@
-103,7
+103,7
@@
ubus_process_msg(struct ubus_context *ctx, struct ubus_msghdr_buf *buf, int fd)
break;
}
break;
}
- ubus_process_obj_msg(ctx, buf);
+ ubus_process_obj_msg(ctx, buf
, fd
);
break;
case UBUS_MSG_MONITOR:
if (ctx->monitor_cb)
break;
case UBUS_MSG_MONITOR:
if (ctx->monitor_cb)
@@
-133,7
+133,7
@@
struct ubus_lookup_request {
static void ubus_lookup_cb(struct ubus_request *ureq, int type, struct blob_attr *msg)
{
struct ubus_lookup_request *req;
static void ubus_lookup_cb(struct ubus_request *ureq, int type, struct blob_attr *msg)
{
struct ubus_lookup_request *req;
- struct ubus_object_data obj;
+ struct ubus_object_data obj
= {}
;
struct blob_attr **attr;
req = container_of(ureq, struct ubus_lookup_request, req);
struct blob_attr **attr;
req = container_of(ureq, struct ubus_lookup_request, req);
@@
-143,7
+143,6
@@
static void ubus_lookup_cb(struct ubus_request *ureq, int type, struct blob_attr
!attr[UBUS_ATTR_OBJTYPE])
return;
!attr[UBUS_ATTR_OBJTYPE])
return;
- memset(&obj, 0, sizeof(obj));
obj.id = blob_get_u32(attr[UBUS_ATTR_OBJID]);
obj.path = blob_data(attr[UBUS_ATTR_OBJPATH]);
obj.type_id = blob_get_u32(attr[UBUS_ATTR_OBJTYPE]);
obj.id = blob_get_u32(attr[UBUS_ATTR_OBJID]);
obj.path = blob_data(attr[UBUS_ATTR_OBJPATH]);
obj.type_id = blob_get_u32(attr[UBUS_ATTR_OBJTYPE]);
@@
-220,7
+219,7
@@
int ubus_register_event_handler(struct ubus_context *ctx,
const char *pattern)
{
struct ubus_object *obj = &ev->obj;
const char *pattern)
{
struct ubus_object *obj = &ev->obj;
- struct blob_buf b2;
+ struct blob_buf b2
= {}
;
int ret;
if (!obj->id) {
int ret;
if (!obj->id) {
@@
-236,7
+235,6
@@
int ubus_register_event_handler(struct ubus_context *ctx,
}
/* use a second buffer, ubus_invoke() overwrites the primary one */
}
/* use a second buffer, ubus_invoke() overwrites the primary one */
- memset(&b2, 0, sizeof(b2));
blob_buf_init(&b2, 0);
blobmsg_add_u32(&b2, "object", obj->id);
if (pattern)
blob_buf_init(&b2, 0);
blobmsg_add_u32(&b2, "object", obj->id);
if (pattern)
@@
-277,6
+275,7
@@
static void ubus_default_connection_lost(struct ubus_context *ctx)
int ubus_connect_ctx(struct ubus_context *ctx, const char *path)
{
int ubus_connect_ctx(struct ubus_context *ctx, const char *path)
{
+ uloop_init();
memset(ctx, 0, sizeof(*ctx));
ctx->sock.fd = -1;
memset(ctx, 0, sizeof(*ctx));
ctx->sock.fd = -1;
@@
-294,6
+293,7
@@
int ubus_connect_ctx(struct ubus_context *ctx, const char *path)
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
if (ubus_reconnect(ctx, path)) {
free(ctx->msgbuf.data);
avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
if (ubus_reconnect(ctx, path)) {
free(ctx->msgbuf.data);
+ ctx->msgbuf.data = NULL;
return -1;
}
return -1;
}
@@
-361,6
+361,7
@@
void ubus_shutdown(struct ubus_context *ctx)
if (!ctx)
return;
close(ctx->sock.fd);
if (!ctx)
return;
close(ctx->sock.fd);
+ uloop_timeout_cancel(&ctx->pending_timer);
free(ctx->msgbuf.data);
}
free(ctx->msgbuf.data);
}