qulogic/libgnt

Fix remaining clang scan-build warnings

2014-04-03, Tomasz Wasilczyk
f062930b10d6
Parents c5116ded3b21
Children 250c6342039e
Fix remaining clang scan-build warnings
--- a/gnttextview.c Thu Apr 03 18:45:27 2014 +0200
+++ b/gnttextview.c Thu Apr 03 19:39:58 2014 +0200
@@ -339,6 +339,9 @@
g_return_val_if_fail(select_start != NULL, TRUE);
select_end = gnt_text_view_get_p(view, x - widget->priv.x, y - widget->priv.y);
+
+ g_return_val_if_fail(select_end != NULL, TRUE);
+
if (select_end < select_start) {
gchar *t = select_start;
select_start = select_end;
@@ -762,7 +765,7 @@
GntTextLine *line = iter->data;
inext = iter->next;
- if (line == NULL) {
+ if (G_UNLIKELY(line == NULL)) {
g_warn_if_reached();
continue;
}
@@ -780,6 +783,10 @@
/* This segment starts in the middle of the tag */
if (text == NULL) {
free_text_segment(seg, NULL);
+ if (G_UNLIKELY(line == NULL)) {
+ g_warn_if_reached();
+ break;
+ }
line->segments = g_list_delete_link(line->segments, segs);
if (line->segments == NULL) {
free_text_line(line, NULL);