From 90406af31a9e4352ab7b5d23cde2f4b4c9e6d4c8 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Thu, 17 Mar 2022 12:28:00 +0100 Subject: Use a cheaper is-empty test for a C-string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We only need to look at the first byte to determine whether the length is > 0; no need to count how many more bytes after it aren't '\0'. Change-Id: Id2db2a9a993086c0aee02c99396fcb346b1a348e Reviewed-by: MÃ¥rten Nordheim --- src/testlib/qtaptestlogger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/testlib/qtaptestlogger.cpp b/src/testlib/qtaptestlogger.cpp index 62fde40d64..9926836c34 100644 --- a/src/testlib/qtaptestlogger.cpp +++ b/src/testlib/qtaptestlogger.cpp @@ -157,7 +157,7 @@ void QTapTestLogger::addIncident(IncidentTypes type, const char *description, QTestCharBuffer directive; if (incident) { QTest::qt_asprintf(&directive, " # %s%s%s", incident, - qstrlen(description) ? " " : "", description); + description && description[0] ? " " : "", description); } int testNumber = QTestLog::totalCount(); -- cgit v1.2.3