Skip to contentSkip to conversation

ui/gtk: Strip trailing '\n' from error string arguments

PATCH In review Philippe Mathieu-Daudé 2 participants 2 messages Jan 18, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ui/gtk: Strip trailing '\n' from error string arguments

error_report() strings should not include trailing newlines.

Noticed running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h \
    --sp-file scripts/coccinelle/err-bad-newline.cocci \
    --keep-comments --use-gitgrep --dir .
  ./ui/gtk.c:1094:56:"gtk: unexpected touch event type\n"
Fixes 5a4cb61ae1 ("ui/gtk: enable backend to send multi-touch events")
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/gtk.c +1 -1
index 810d7fc796..c819c72a20 100644
@@ -1091,7 +1091,7 @@ static gboolean gd_touch_event(GtkWidget *widget, GdkEventTouch *touch,
         type = INPUT_MULTI_TOUCH_TYPE_END;
         break;
     default:
-        warn_report("gtk: unexpected touch event type\n");
+        warn_report("gtk: unexpected touch event type");
         return FALSE;
     }
 
Signature · 1 line
2.41.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 22 lines · Philippe Mathieu-Daudé

error_report() strings should not include trailing newlines.

Noticed running:

  $ spatch \
    --macro-file scripts/cocci-macro-file.h \
    --sp-file scripts/coccinelle/err-bad-newline.cocci \
    --keep-comments --use-gitgrep --dir .
  ./ui/gtk.c:1094:56:"gtk: unexpected touch event type\n"
Fixes 5a4cb61ae1 ("ui/gtk: enable backend to send multi-touch events")
---
 ui/gtk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ui/gtk.c +0 -0
index 810d7fc796..c819c72a20 100644

ui/gtk.c static gboolean gd_touch_event(GtkWidget *widget, GdkEventTouch *touch, · line 1096

Quoted 7 lines
ui/gtk.c +1 -1
@@ -1091,7 +1091,7 @@ static gboolean gd_touch_event(GtkWidget *widget, GdkEventTouch *touch,
         type = INPUT_MULTI_TOUCH_TYPE_END;
         break;
     default:
-        warn_report("gtk: unexpected touch event type\n");
+        warn_report("gtk: unexpected touch event type");
         return FALSE;
     }

I don't like the error message (drop the "gtk: " prefix or work it into the message), but that's a separate issue.