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,
|
||||
_ret_error: *mut sd_bus_error,
|
||||
) -> libc::c_int {
|
||||
let current_block: u64;
|
||||
let mut is_error: bool = false;
|
||||
let mut name: *const libc::c_char = ptr::null();
|
||||
log::debug!("PropertiesChanged signal received");
|
||||
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>(),
|
||||
);
|
||||
if ret < 0 as libc::c_int {
|
||||
current_block = 8099226602202575710;
|
||||
is_error = true;
|
||||
} else {
|
||||
let mut prop: *const libc::c_char = ptr::null();
|
||||
loop {
|
||||
|
@ -640,7 +640,6 @@ unsafe extern "C" fn handle_property_changed(
|
|||
(b"sv\0" as *const u8).cast::<libc::c_char>(),
|
||||
);
|
||||
if ret <= 0 {
|
||||
current_block = 18317007320854588510;
|
||||
break;
|
||||
}
|
||||
ret = sd_bus_message_read_basic(
|
||||
|
@ -649,7 +648,7 @@ unsafe extern "C" fn handle_property_changed(
|
|||
ptr::addr_of_mut!(prop).cast(),
|
||||
);
|
||||
if ret < 0 as libc::c_int {
|
||||
current_block = 8099226602202575710;
|
||||
is_error = true;
|
||||
break;
|
||||
}
|
||||
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>());
|
||||
if ret < 0 as libc::c_int {
|
||||
current_block = 8099226602202575710;
|
||||
is_error = true;
|
||||
break;
|
||||
}
|
||||
ret = sd_bus_message_exit_container(msg);
|
||||
if ret < 0 as libc::c_int {
|
||||
current_block = 8099226602202575710;
|
||||
is_error = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
current_block = 18317007320854588510;
|
||||
}
|
||||
match current_block {
|
||||
8099226602202575710 => {}
|
||||
_ => {
|
||||
if ret >= 0 {
|
||||
return 0 as libc::c_int;
|
||||
}
|
||||
}
|
||||
if !is_error && ret >= 0 {
|
||||
return 0 as libc::c_int;
|
||||
}
|
||||
}
|
||||
*__errno_location() = -ret;
|
||||
|
@ -729,7 +721,7 @@ unsafe extern "C" fn dbus_event(
|
|||
count
|
||||
}
|
||||
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 error: sd_bus_error = sd_bus_error {
|
||||
name: ptr::null(),
|
||||
|
@ -766,14 +758,10 @@ unsafe extern "C" fn set_session() {
|
|||
if ret < 0 as libc::c_int {
|
||||
log::debug!("GetSessionByPID failed: {}", read_str(error.message));
|
||||
log::error!("Failed to find session");
|
||||
current_block = 5197767760103794011;
|
||||
} else {
|
||||
current_block = 6937071982253665452;
|
||||
is_error = true;
|
||||
}
|
||||
} else {
|
||||
current_block = 6937071982253665452;
|
||||
}
|
||||
if current_block == 6937071982253665452 {
|
||||
if !is_error {
|
||||
ret = sd_bus_message_read(
|
||||
msg,
|
||||
(b"o\0" as *const u8).cast::<libc::c_char>(),
|
||||
|
|
Loading…
Reference in a new issue