[education/rkward] rkward/rbackend: Fix more clazy warnings (mostly NULL ptr)

Thomas Friedrichsmeier null at kde.org
Sun May 12 16:32:29 BST 2024


Git commit 4518c9bf770e079f747727430e7d70e3402a525d by Thomas Friedrichsmeier.
Committed on 11/05/2024 at 10:08.
Pushed by tfry into branch 'master'.

Fix more clazy warnings (mostly NULL ptr)

M  +1    -1    rkward/rbackend/rkfrontendtransmitter.cpp
M  +5    -5    rkward/rbackend/rkrbackend.cpp
M  +1    -1    rkward/rbackend/rkreventloop.cpp

https://invent.kde.org/education/rkward/-/commit/4518c9bf770e079f747727430e7d70e3402a525d

diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp
index eb4bbbc86..72465bcce 100644
--- a/rkward/rbackend/rkfrontendtransmitter.cpp
+++ b/rkward/rbackend/rkfrontendtransmitter.cpp
@@ -54,7 +54,7 @@ QString findBackendLibAtPath(const QString &path) {
 	QString ret = dir.filePath("librkward.rbackend.lib.so");
 #endif
 	RK_DEBUG(RBACKEND, DL_DEBUG, "Looking for backend lib at %s", qPrintable(ret));
-	if (QFileInfo(ret).exists()) return ret;
+	if (QFileInfo::exists(ret)) return ret;
 	return QString();
 }
 #endif
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index 8b771fb93..15fbda85b 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -1049,7 +1049,7 @@ bool RKRBackend::startR () {
 #ifndef Q_OS_WIN
 	// safety check: If we are beyond the stack boundaries already, we better disable stack checking
 	// this has to come *after* the first setup_Rmainloop ()!
-	Rboolean stack_ok = RFn::R_ToplevelExec(R_CheckStackWrapper, (void *) 0);
+	Rboolean stack_ok = RFn::R_ToplevelExec(R_CheckStackWrapper, nullptr);
 	if (!stack_ok) {
 		RK_DEBUG (RBACKEND, DL_WARNING, "R_CheckStack() failed during initialization. Will disable stack checking and try to re-initialize.");
 		RK_DEBUG (RBACKEND, DL_WARNING, "Whether or not things work after this, *please* submit a bug report.");
@@ -1098,7 +1098,7 @@ bool RKRBackend::startR () {
 		{ "rk.graphics.device.resize", (DL_FUNC) (void*) &RKD_AdjustSize, 2},
 		{ nullptr, nullptr, 0 }
 	};
-	RFn::R_registerRoutines(RFn::R_getEmbeddingDllInfo(), NULL, callMethods, NULL, NULL);
+	RFn::R_registerRoutines(RFn::R_getEmbeddingDllInfo(), nullptr, callMethods, nullptr, nullptr);
 
 	connectCallbacks();
 	RKInsertToplevelStatementFinishedCallback(nullptr);
@@ -1150,9 +1150,9 @@ void completeForkMaster () {
 	// Block SIGCHLD in the main thread from now on. I don't fully understand, why, but otherwise, these signals
 	// interrupt the select() call in the fork()ing code of library(parallel)
 	sigset_t new_set;
-	sigemptyset (&new_set);
-	sigaddset (&new_set, SIGCHLD);
-	pthread_sigmask (SIG_BLOCK, &new_set, NULL);
+	sigemptyset(&new_set);
+	sigaddset(&new_set, SIGCHLD);
+	pthread_sigmask(SIG_BLOCK, &new_set, nullptr);
 
 //	This was used to show a warning message. Unfortunately, however, forks also occur on every popen (i.e. in system(..., intern=TRUE).
 //	RKRBackend::this_pointer->handlePlainGenericRequest (QStringList ("forkNotification"), false);
diff --git a/rkward/rbackend/rkreventloop.cpp b/rkward/rbackend/rkreventloop.cpp
index 7583d2d1b..8671cc725 100644
--- a/rkward/rbackend/rkreventloop.cpp
+++ b/rkward/rbackend/rkreventloop.cpp
@@ -21,7 +21,7 @@ static void processX11EventsWorker (void *) {
 		fd_set *what;
 		what = RFn::R_checkActivityEx(ROb(R_wait_usec) > 0 ? ROb(R_wait_usec) : 50, 1, RK_doIntr);
 		RFn::R_runHandlers(ROb(R_InputHandlers), what);
-		if (what == NULL) break;
+		if (!what) break;
 	}
 	/* This seems to be needed to make Rcmdr react to events. Has this always been the case? It was commented out for a long time, without anybody noticing. */
 	(*ROb(R_PolledEvents))();



More information about the rkward-tracker mailing list