[X2Go-Commits] [nx-libs] 179/429: NXpicture.c: remove unneccessary check

git-admin at x2go.org git-admin at x2go.org
Mon Oct 18 09:36:25 CEST 2021


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch 3.6.x
in repository nx-libs.

commit 5871100dd5db7f05e3f67cd90fda25dc9a68a29d
Author: Ulrich Sibiller <uli42 at gmx.de>
Date:   Mon Aug 3 17:08:30 2020 +0200

    NXpicture.c: remove unneccessary check
    
    Code can only be reached if pPicture is non-NULL. Besides, pPicture
    will be accessed later anyway, regardless of this check.
    
    Finding of PVS Studio: "V547 Expression 'pPicture != NULL' is always true."
---
 nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 27 ++++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
index 159a7b55d..ae9de652a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
@@ -320,27 +320,24 @@ static PicturePtr createSourcePicture(void)
     if (!pPicture)
       return 0;
 
-    if (pPicture != NULL)
-    {
-      DevUnion *ppriv = (DevUnion *) (pPicture + 1);
+    DevUnion *ppriv = (DevUnion *) (pPicture + 1);
 
-      for (int i = 0; i < picturePrivateCount; ++i)
-      {
-        /*
-         * Other privates are inaccessible.
-         */
+    for (int i = 0; i < picturePrivateCount; ++i)
+    {
+      /*
+       * Other privates are inaccessible.
+       */
 
-        ppriv[i].ptr = NULL;
-      }
+      ppriv[i].ptr = NULL;
+    }
 
-      char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
+    char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount];
 
-      ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr;
+    ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr;
 
-      pPicture -> devPrivates = ppriv;
+    pPicture -> devPrivates = ppriv;
 
-      nxagentPicturePriv(pPicture) -> picture = 0;
-    }
+    nxagentPicturePriv(pPicture) -> picture = 0;
 
     pPicture->pDrawable = 0;
     pPicture->pFormat = 0;

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/nx-libs.git


More information about the x2go-commits mailing list