Skip to content

Commit 4509418

Browse files
committed
exclude useless null guards
1 parent 80ba96f commit 4509418

2 files changed

Lines changed: 3 additions & 14 deletions

File tree

lang/libs/window/posix/linux.ch

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,6 @@ func linux_on_drag_data_received(
622622
// ===========================================================================
623623

624624
public func window_create(w : *mut Window) : std::Result<std::Unit, WindowError> {
625-
if(w == null) {
626-
return std.Result.Err(WindowError.InvalidState(string("window_create: null window")))
627-
}
628625
if(w.created) {
629626
return std.Result.Err(WindowError.InvalidState(string("window_create: window already created")))
630627
}
@@ -725,9 +722,6 @@ public func window_create(w : *mut Window) : std::Result<std::Unit, WindowError>
725722
}
726723

727724
public func window_destroy(w : *mut Window) {
728-
if(w == null) {
729-
return
730-
}
731725
if(g_quit_by_destroy != 0) {
732726
// The window was already destroyed by the user (the main loop quit
733727
// because the destroy handler fired) — the widget pointer may be
@@ -746,9 +740,6 @@ public func window_destroy(w : *mut Window) {
746740
}
747741

748742
public func window_is_created(w : *mut Window) : bool {
749-
if(w == null) {
750-
return false
751-
}
752743
return w.created && w.widget != null
753744
}
754745

@@ -912,7 +903,7 @@ public func window_set_cursor(w : *mut Window, cursor : int) {
912903
}
913904

914905
public func window_set_icon(w : *mut Window, path : *char) {
915-
if(w.widget == null || path == null) {
906+
if(w.widget == null) {
916907
return
917908
}
918909
var err : *mut GError = null

lang/libs/window/win/win.ch

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,9 +721,7 @@ public func window_title(w : *mut Window) : string {
721721

722722
public func window_set_title(w : *mut Window, title : *char) {
723723
w.title = string("")
724-
if(title != null) {
725-
w.title.append_char_ptr(title)
726-
}
724+
w.title.append_char_ptr(title)
727725
if(w.hwnd != null) {
728726
unsafe var wbuf : [512]ushort
729727
widen_to_buf(title, &raw mut wbuf[0], 512)
@@ -911,7 +909,7 @@ public func window_set_cursor(w : *mut Window, cursor : int) {
911909
}
912910

913911
public func window_set_icon(w : *mut Window, path : *char) {
914-
if(w.hwnd == null || path == null) {
912+
if(w.hwnd == null) {
915913
return
916914
}
917915
unsafe var wbuf : [1024]ushort

0 commit comments

Comments
 (0)