struct livebox *handler;
char *new_content;
int ret;
+ int status;
int pinup;
- ret = packet_get(packet, "iisss", &ret, &pinup, &pkgname, &id, &content);
+ ret = packet_get(packet, "iisss", &status, &pinup, &pkgname, &id, &content);
if (ret != 5) {
ErrPrint("Invalid argument\n");
goto out;
goto out;
}
- if (ret == 0) {
+ if (status == 0) {
new_content = strdup(content);
if (new_content) {
free(handler->content);
handler->is_pinned_up = pinup;
} else {
ErrPrint("Heap: %s\n", strerror(errno));
- ret = LB_STATUS_ERROR_MEMORY;
+ status = LB_STATUS_ERROR_MEMORY;
}
}
if (handler->pinup_cb) {
- handler->pinup_cb(handler, ret, handler->pinup_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ /* Make sure that user can call pinup API in its result callback */
+ cb = handler->pinup_cb;
+ cbdata = handler->pinup_cbdata;
- handler->pinup_cb = NULL; /*!< Reset pinup cb */
+ handler->pinup_cb = NULL;
handler->pinup_cbdata = NULL;
- } else if (ret == 0) {
+
+ cb(handler, status, cbdata);
+ } else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PINUP_CHANGED);
}
}
if (handler->created_cb) {
+ ret_cb_t cb;
+ void *cbdata;
/*!
* \note
*
}
DbgPrint("Call the created cb with LB_STATUS_ERROR_CANCEL\n");
- handler->created_cb(handler, LB_STATUS_ERROR_CANCEL, handler->created_cbdata);
+ cb = handler->created_cb;
+ cbdata = handler->created_cbdata;
+
handler->created_cb = NULL;
handler->created_cbdata = NULL;
+
+ cb(handler, LB_STATUS_ERROR_CANCEL, cbdata);
} else if (handler->id) {
if (handler->deleted_cb) {
- DbgPrint("Call the deleted cb\n");
- handler->deleted_cb(handler, LB_STATUS_SUCCESS, handler->deleted_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->deleted_cb;
+ cbdata = handler->deleted_cbdata;
handler->deleted_cb = NULL;
handler->deleted_cbdata = NULL;
+
+ DbgPrint("Call the deleted cb\n");
+ cb(handler, LB_STATUS_SUCCESS, cbdata);
} else {
DbgPrint("Call the lb,deleted\n");
lb_invoke_event_handler(handler, LB_EVENT_DELETED);
DbgPrint("Access status: %d\n", status);
if (handler->access_event_cb) {
- handler->access_event_cb(handler, status, handler->access_event_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->access_event_cb;
+ cbdata = handler->access_event_cbdata;
+
handler->access_event_cb = NULL;
handler->access_event_cbdata = NULL;
+
+ cb(handler, status, cbdata);
} else {
ErrPrint("Invalid event[%s]\n", id);
}
handler->is_pd_created = (status == 0);
if (handler->pd_created_cb) {
- DbgPrint("pd_created_cb (%s) - %d\n", buf_id, status);
- handler->pd_created_cb(handler, status, handler->pd_created_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->pd_created_cb;
+ cbdata = handler->pd_created_cbdata;
handler->pd_created_cb = NULL;
handler->pd_created_cbdata = NULL;
+
+ DbgPrint("pd_created_cb (%s) - %d\n", buf_id, status);
+ cb(handler, status, cbdata);
} else if (status == 0) {
DbgPrint("LB_EVENT_PD_CREATED (%s) - %d\n", buf_id, status);
lb_invoke_event_handler(handler, LB_EVENT_PD_CREATED);
handler->is_pd_created = 0;
if (handler->pd_destroyed_cb) {
- DbgPrint("Invoke the PD Destroyed CB\n");
- handler->pd_destroyed_cb(handler, status, handler->pd_destroyed_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->pd_destroyed_cb;
+ cbdata = handler->pd_destroyed_cbdata;
handler->pd_destroyed_cb = NULL;
handler->pd_destroyed_cbdata = NULL;
+
+ DbgPrint("Invoke the PD Destroyed CB\n");
+ cb(handler, status, cbdata);
} else if (status == 0) {
DbgPrint("Invoke the LB_EVENT_PD_DESTROYED event\n");
lb_invoke_event_handler(handler, LB_EVENT_PD_DESTROYED);
lb_set_update_mode(handler, active_mode);
if (handler->update_mode_cb) {
- handler->update_mode_cb(handler, status, handler->update_mode_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->update_mode_cb;
+ cbdata = handler->update_mode_cbdata;
handler->update_mode_cb = NULL;
handler->update_mode_cbdata = NULL;
+
+ cb(handler, status, cbdata);
} else {
lb_invoke_event_handler(handler, LB_EVENT_UPDATE_MODE_CHANGED);
}
* So I added some log before & after call the user callback.
*/
if (handler->size_changed_cb) {
- handler->size_changed_cb(handler, status, handler->size_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->size_changed_cb;
+ cbdata = handler->size_cbdata;
handler->size_changed_cb = NULL;
handler->size_cbdata = NULL;
+
+ cb(handler, status, cbdata);
} else {
lb_invoke_event_handler(handler, LB_EVENT_LB_SIZE_CHANGED);
}
} else {
DbgPrint("LB is not resized: %dx%d (%d)\n", w, h, status);
if (handler->size_changed_cb) {
- handler->size_changed_cb(handler, status, handler->size_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->size_changed_cb;
+ cbdata = handler->size_cbdata;
handler->size_changed_cb = NULL;
handler->size_cbdata = NULL;
+
+ cb(handler, status, cbdata);
}
}
}
lb_set_period(handler, period);
if (handler->period_changed_cb) {
- handler->period_changed_cb(handler, status, handler->group_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->period_changed_cb;
+ cbdata = handler->period_cbdata;
handler->period_changed_cb = NULL;
handler->period_cbdata = NULL;
+
+ cb(handler, status, cbdata);
} else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_PERIOD_CHANGED);
}
(void)lb_set_group(handler, cluster, category);
if (handler->group_changed_cb) {
- handler->group_changed_cb(handler, status, handler->group_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->group_changed_cb;
+ cbdata = handler->group_cbdata;
handler->group_changed_cb = NULL;
handler->group_cbdata = NULL;
+
+ cb(handler, status, cbdata);
} else if (status == 0) {
lb_invoke_event_handler(handler, LB_EVENT_GROUP_CHANGED);
}
*/
if (handler->created_cb) {
- DbgPrint("Invoke the created_cb\n");
- handler->created_cb(handler, ret, handler->created_cbdata);
+ ret_cb_t cb;
+ void *cbdata;
+
+ cb = handler->created_cb;
+ cbdata = handler->created_cbdata;
handler->created_cb = NULL;
handler->created_cbdata = NULL;
+
+ DbgPrint("Invoke the created_cb\n");
+ cb(handler, ret, cbdata);
} else {
DbgPrint("Invoke the lb,created\n");
lb_invoke_event_handler(handler, LB_EVENT_CREATED);