Don't check for peer->xc_handler before it can be set; and...

...remove unnecessary checks in nvpair/nvlist
This commit is contained in:
Ariel Abreu 2020-04-10 10:10:27 -04:00
parent 087a54b95a
commit 1cbf7e4e75
No known key found for this signature in database
GPG Key ID: 6EA25D8348CAA137
3 changed files with 16 additions and 15 deletions

View File

@ -615,7 +615,7 @@ nvlist_xdescriptors(const nvlist_t *nvl, int *descs, int level)
NVLIST_ASSERT(nvl);
PJDLOG_ASSERT(nvl->nvl_error == 0);
PJDLOG_ASSERT(level < 3);
//PJDLOG_ASSERT(level < 3);
for (nvp = nvlist_first_nvpair(nvl); nvp != NULL;
nvp = nvlist_next_nvpair(nvl, nvp)) {
@ -666,7 +666,7 @@ nvlist_xndescriptors(const nvlist_t *nvl, int level)
NVLIST_ASSERT(nvl);
PJDLOG_ASSERT(nvl->nvl_error == 0);
PJDLOG_ASSERT(level < 3);
//PJDLOG_ASSERT(level < 3);
ndescs = 0;
for (nvp = nvlist_first_nvpair(nvl); nvp != NULL;
@ -1463,7 +1463,7 @@ void
nvlist_add_binary(nvlist_t *nvl, const char *name, const void *value,
size_t size)
{
nvlist_addf_binary(nvl, value, size, "%s", name);
}
@ -1883,6 +1883,8 @@ nvlist_addv_binary(nvlist_t *nvl, const void *value, size_t size,
{
nvpair_t *nvp;
debugf("nvlist_error = %d\n", nvlist_error(nvl));
if (nvlist_error(nvl) != 0) {
RESTORE_ERRNO(nvlist_error(nvl));
return;

View File

@ -690,7 +690,7 @@ nvpair_unpack_binary(bool isbe __unused, nvpair_t *nvp,
PJDLOG_ASSERT(nvp->nvp_type == NV_TYPE_BINARY);
if (*leftp < nvp->nvp_datasize || nvp->nvp_datasize == 0) {
if (*leftp < nvp->nvp_datasize) {
RESTORE_ERRNO(EINVAL);
return (NULL);
}
@ -1091,7 +1091,7 @@ nvpair_createv_binary(const void *value, size_t size, const char *namefmt,
nvpair_t *nvp;
void *data;
if (value == NULL || size == 0) {
if (value == NULL) {
RESTORE_ERRNO(EINVAL);
return (NULL);
}
@ -1320,7 +1320,7 @@ nvpair_movev_binary(void *value, size_t size, const char *namefmt,
nvpair_t *nvp;
int serrno;
if (value == NULL || size == 0) {
if (value == NULL) {
RESTORE_ERRNO(EINVAL);
return (NULL);
}

View File

@ -494,17 +494,16 @@ xpc_connection_recv_message(void *context)
debugf("Sync run conn handler");
conn->xc_handler(peerx);
debugf("Sync conn handler done");
if (peer->xc_handler) {
dispatch_async(peer->xc_target_queue, ^{
debugf("Sync result handler");
peer->xc_handler(result);
debugf("Sync result handler done");
});
}
});
}
if (peer->xc_handler) {
dispatch_async(peer->xc_target_queue, ^{
debugf("Sync result handler");
peer->xc_handler(result);
debugf("Sync result handler done");
});
}
} else {
xpc_connection_set_credentials(conn,
((struct xpc_object *)result)->xo_audit_token);