remove gotos
This commit is contained in:
parent
81dd179302
commit
7bd10bbfd5
32
src/main.rs
32
src/main.rs
|
@ -609,7 +609,7 @@ unsafe extern "C" fn handle_property_changed(
|
||||||
_userdata: *mut libc::c_void,
|
_userdata: *mut libc::c_void,
|
||||||
_ret_error: *mut sd_bus_error,
|
_ret_error: *mut sd_bus_error,
|
||||||
) -> libc::c_int {
|
) -> libc::c_int {
|
||||||
let current_block: u64;
|
let mut is_error: bool = false;
|
||||||
let mut name: *const libc::c_char = ptr::null();
|
let mut name: *const libc::c_char = ptr::null();
|
||||||
log::debug!("PropertiesChanged signal received");
|
log::debug!("PropertiesChanged signal received");
|
||||||
let mut ret: libc::c_int = sd_bus_message_read_basic(
|
let mut ret: libc::c_int = sd_bus_message_read_basic(
|
||||||
|
@ -630,7 +630,7 @@ unsafe extern "C" fn handle_property_changed(
|
||||||
(b"{sv}\0" as *const u8).cast::<libc::c_char>(),
|
(b"{sv}\0" as *const u8).cast::<libc::c_char>(),
|
||||||
);
|
);
|
||||||
if ret < 0 as libc::c_int {
|
if ret < 0 as libc::c_int {
|
||||||
current_block = 8099226602202575710;
|
is_error = true;
|
||||||
} else {
|
} else {
|
||||||
let mut prop: *const libc::c_char = ptr::null();
|
let mut prop: *const libc::c_char = ptr::null();
|
||||||
loop {
|
loop {
|
||||||
|
@ -640,7 +640,6 @@ unsafe extern "C" fn handle_property_changed(
|
||||||
(b"sv\0" as *const u8).cast::<libc::c_char>(),
|
(b"sv\0" as *const u8).cast::<libc::c_char>(),
|
||||||
);
|
);
|
||||||
if ret <= 0 {
|
if ret <= 0 {
|
||||||
current_block = 18317007320854588510;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = sd_bus_message_read_basic(
|
ret = sd_bus_message_read_basic(
|
||||||
|
@ -649,7 +648,7 @@ unsafe extern "C" fn handle_property_changed(
|
||||||
ptr::addr_of_mut!(prop).cast(),
|
ptr::addr_of_mut!(prop).cast(),
|
||||||
);
|
);
|
||||||
if ret < 0 as libc::c_int {
|
if ret < 0 as libc::c_int {
|
||||||
current_block = 8099226602202575710;
|
is_error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if strcmp(
|
if strcmp(
|
||||||
|
@ -668,26 +667,19 @@ unsafe extern "C" fn handle_property_changed(
|
||||||
}
|
}
|
||||||
ret = sd_bus_message_skip(msg, (b"v\0" as *const u8).cast::<libc::c_char>());
|
ret = sd_bus_message_skip(msg, (b"v\0" as *const u8).cast::<libc::c_char>());
|
||||||
if ret < 0 as libc::c_int {
|
if ret < 0 as libc::c_int {
|
||||||
current_block = 8099226602202575710;
|
is_error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret = sd_bus_message_exit_container(msg);
|
ret = sd_bus_message_exit_container(msg);
|
||||||
if ret < 0 as libc::c_int {
|
if ret < 0 as libc::c_int {
|
||||||
current_block = 8099226602202575710;
|
is_error = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 18317007320854588510;
|
|
||||||
}
|
}
|
||||||
match current_block {
|
if !is_error && ret >= 0 {
|
||||||
8099226602202575710 => {}
|
return 0 as libc::c_int;
|
||||||
_ => {
|
|
||||||
if ret >= 0 {
|
|
||||||
return 0 as libc::c_int;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*__errno_location() = -ret;
|
*__errno_location() = -ret;
|
||||||
|
@ -729,7 +721,7 @@ unsafe extern "C" fn dbus_event(
|
||||||
count
|
count
|
||||||
}
|
}
|
||||||
unsafe extern "C" fn set_session() {
|
unsafe extern "C" fn set_session() {
|
||||||
let current_block: u64;
|
let mut is_error: bool = false;
|
||||||
let mut msg: *mut sd_bus_message = ptr::null_mut();
|
let mut msg: *mut sd_bus_message = ptr::null_mut();
|
||||||
let mut error: sd_bus_error = sd_bus_error {
|
let mut error: sd_bus_error = sd_bus_error {
|
||||||
name: ptr::null(),
|
name: ptr::null(),
|
||||||
|
@ -766,14 +758,10 @@ unsafe extern "C" fn set_session() {
|
||||||
if ret < 0 as libc::c_int {
|
if ret < 0 as libc::c_int {
|
||||||
log::debug!("GetSessionByPID failed: {}", read_str(error.message));
|
log::debug!("GetSessionByPID failed: {}", read_str(error.message));
|
||||||
log::error!("Failed to find session");
|
log::error!("Failed to find session");
|
||||||
current_block = 5197767760103794011;
|
is_error = true;
|
||||||
} else {
|
|
||||||
current_block = 6937071982253665452;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
current_block = 6937071982253665452;
|
|
||||||
}
|
}
|
||||||
if current_block == 6937071982253665452 {
|
if !is_error {
|
||||||
ret = sd_bus_message_read(
|
ret = sd_bus_message_read(
|
||||||
msg,
|
msg,
|
||||||
(b"o\0" as *const u8).cast::<libc::c_char>(),
|
(b"o\0" as *const u8).cast::<libc::c_char>(),
|
||||||
|
|
Loading…
Reference in a new issue