diff src/diff.c @ 26829:88a33cf5aeb6 v8.2.3943

patch 8.2.3943: compiler warning from gcc for uninitialized variable Commit: https://github.com/vim/vim/commit/491669701c72578f273db53e579d8a03a9deac0c Author: Bram Moolenaar <Bram@vim.org> Date: Thu Dec 30 10:51:45 2021 +0000 patch 8.2.3943: compiler warning from gcc for uninitialized variable Problem: Compiler warning from gcc for uninitialized variable. Solution: Initialize variable. (closes https://github.com/vim/vim/issues/9429)
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Dec 2021 12:00:03 +0100
parents 77ff030699d2
children 06a137af96f8
line wrap: on
line diff
--- a/src/diff.c
+++ b/src/diff.c
@@ -1636,7 +1636,7 @@ diff_read(
     long	off;
     int		i;
     int		notset = TRUE;	    // block "*dp" not set yet
-    diffhunk_T	*hunk;
+    diffhunk_T	*hunk = NULL;	    // init to avoid gcc warning
 
     enum {
 	DIFF_ED,
@@ -1662,10 +1662,7 @@ diff_read(
     {
 	hunk = ALLOC_ONE(diffhunk_T);
 	if (hunk == NULL)
-	{
-	    emsg(_("E98: Cannot read diff output"));
 	    return;
-	}
     }
 
     for (;;)