]> granicus.if.org Git - vim/commitdiff
patch 8.1.0886: compiler warning for NULL pointer and condition always true v8.1.0886
authorBram Moolenaar <Bram@vim.org>
Sun, 10 Feb 2019 20:48:25 +0000 (21:48 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 10 Feb 2019 20:48:25 +0000 (21:48 +0100)
Problem:    Compiler warning for adding to NULL pointer and a condition that
            is always true.
Solution:   Check for NULL pointer before adding. Remove useless "if".
            (Friedirch, closes #3913)

src/dosinst.c
src/search.c
src/version.c

index 5b05598872d68133b03f6fe327a6d6e15562a79d..7025eb6184356867f3aa7739db51b8523d6df2ae 100644 (file)
@@ -291,16 +291,17 @@ findoldfile(char **destination)
 {
     char       *bp = *destination;
     size_t     indir_l = strlen(installdir);
-    char       *cp = bp + indir_l;
+    char       *cp;
     char       *tmpname;
     char       *farname;
 
     /*
      * No action needed if exe not found or not in this directory.
      */
-    if (bp == NULL
-           || strnicmp(bp, installdir, indir_l) != 0
-           || strchr("/\\", *cp++) == NULL
+    if (bp == NULL || strnicmp(bp, installdir, indir_l) != 0)
+       return;
+    cp = bp + indir_l;
+    if (strchr("/\\", *cp++) == NULL
            || strchr(cp, '\\') != NULL
            || strchr(cp, '/') != NULL)
        return;
index 4b3f8532a55818e137c885a031ea88d1a860c8a6..df7067b08f4954e7704d47dd61ce52b1a76ec67b 100644 (file)
@@ -4732,18 +4732,14 @@ current_search(
     VIsual_active = TRUE;
     VIsual_mode = 'v';
 
-    if (VIsual_active)
+    redraw_curbuf_later(INVERTED);     /* update the inversion */
+    if (*p_sel == 'e')
     {
-       redraw_curbuf_later(INVERTED);  /* update the inversion */
-       if (*p_sel == 'e')
-       {
-           /* Correction for exclusive selection depends on the direction. */
-           if (forward && LTOREQ_POS(VIsual, curwin->w_cursor))
-               inc_cursor();
-           else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual))
-               inc(&VIsual);
-       }
-
+       /* Correction for exclusive selection depends on the direction. */
+       if (forward && LTOREQ_POS(VIsual, curwin->w_cursor))
+           inc_cursor();
+       else if (!forward && LTOREQ_POS(curwin->w_cursor, VIsual))
+           inc(&VIsual);
     }
 
 #ifdef FEAT_FOLDING
index 641d8020ca2fcbabb22546a652b15aa6a555e02f..aa17e0afa3b9e03fde39daccf5594dfb9360810d 100644 (file)
@@ -783,6 +783,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    886,
 /**/
     885,
 /**/