diff options
author | Anton Ovchinnikov <revolver112@gmail.com> | 2015-03-15 10:39:59 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2015-03-16 11:01:09 -0400 |
commit | 76970fe2c18e74c9090ba0ebc59b9e4e0376ec00 (patch) | |
tree | 506c36573d742f2e208a119bc9544e37e1b37af7 /src | |
parent | 53452663cc2e9f629361282476d74c54eb5c58ec (diff) | |
download | rneovim-76970fe2c18e74c9090ba0ebc59b9e4e0376ec00.tar.gz rneovim-76970fe2c18e74c9090ba0ebc59b9e4e0376ec00.tar.bz2 rneovim-76970fe2c18e74c9090ba0ebc59b9e4e0376ec00.zip |
Clarify an out-of-memory cleanup, remove a function-wide loop counter
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/memline.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 1dc3a27415..5a577c6378 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -1277,7 +1277,6 @@ recover_names ( int num_files; int file_count = 0; char_u **files; - int i; char_u *dirp; char_u *dir_name; char_u *fname_res = NULL; @@ -1357,12 +1356,13 @@ recover_names ( } } - /* check for out-of-memory */ - for (i = 0; i < num_names; ++i) { + // check for out-of-memory + for (int i = 0; i < num_names; ++i) { if (names[i] == NULL) { - for (i = 0; i < num_names; ++i) - free(names[i]); + for (int j = 0; j < num_names; ++j) + free(names[j]); num_names = 0; + break; } } if (num_names == 0) @@ -1394,7 +1394,7 @@ recover_names ( */ if (curbuf->b_ml.ml_mfp != NULL && (p = curbuf->b_ml.ml_mfp->mf_fname) != NULL) { - for (i = 0; i < num_files; ++i) + for (int i = 0; i < num_files; ++i) if (path_full_compare(p, files[i], TRUE) & kEqualFiles) { /* Remove the name from files[i]. Move further entries * down. When the array becomes empty free it here, since @@ -1427,7 +1427,7 @@ recover_names ( } if (num_files) { - for (i = 0; i < num_files; ++i) { + for (int i = 0; i < num_files; ++i) { /* print the swap file name */ msg_outnum((long)++file_count); MSG_PUTS(". "); @@ -1441,7 +1441,7 @@ recover_names ( } else file_count += num_files; - for (i = 0; i < num_names; ++i) + for (int i = 0; i < num_names; ++i) free(names[i]); if (num_files > 0) FreeWild(num_files, files); |