Mercurial > vim
comparison src/diff.c @ 16764:ef00b6bc186b v8.1.1384
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri May 24 18:54:09 2019 +0200
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Problem: Using "int" for alloc() often results in compiler warnings.
Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim
only works with 32 bit ints anyway.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 24 May 2019 19:00:07 +0200 |
parents | ced614446eaa |
children | 695d9ef00b03 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
535 static diff_T * | 535 static diff_T * |
536 diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp) | 536 diff_alloc_new(tabpage_T *tp, diff_T *dprev, diff_T *dp) |
537 { | 537 { |
538 diff_T *dnew; | 538 diff_T *dnew; |
539 | 539 |
540 dnew = (diff_T *)alloc((unsigned)sizeof(diff_T)); | 540 dnew = (diff_T *)alloc(sizeof(diff_T)); |
541 if (dnew != NULL) | 541 if (dnew != NULL) |
542 { | 542 { |
543 dnew->df_next = dp; | 543 dnew->df_next = dp; |
544 if (dprev == NULL) | 544 if (dprev == NULL) |
545 tp->tp_first_diff = dnew; | 545 tp->tp_first_diff = dnew; |
1121 } | 1121 } |
1122 else | 1122 else |
1123 { | 1123 { |
1124 len = STRLEN(tmp_orig) + STRLEN(tmp_new) | 1124 len = STRLEN(tmp_orig) + STRLEN(tmp_new) |
1125 + STRLEN(tmp_diff) + STRLEN(p_srr) + 27; | 1125 + STRLEN(tmp_diff) + STRLEN(p_srr) + 27; |
1126 cmd = alloc((unsigned)len); | 1126 cmd = alloc(len); |
1127 if (cmd == NULL) | 1127 if (cmd == NULL) |
1128 return FAIL; | 1128 return FAIL; |
1129 | 1129 |
1130 // We don't want $DIFF_OPTIONS to get in the way. | 1130 // We don't want $DIFF_OPTIONS to get in the way. |
1131 if (getenv("DIFF_OPTIONS")) | 1131 if (getenv("DIFF_OPTIONS")) |
1216 # endif | 1216 # endif |
1217 eap->arg, TRUE, TRUE); | 1217 eap->arg, TRUE, TRUE); |
1218 if (esc_name == NULL) | 1218 if (esc_name == NULL) |
1219 goto theend; | 1219 goto theend; |
1220 buflen = STRLEN(tmp_orig) + STRLEN(esc_name) + STRLEN(tmp_new) + 16; | 1220 buflen = STRLEN(tmp_orig) + STRLEN(esc_name) + STRLEN(tmp_new) + 16; |
1221 buf = alloc((unsigned)buflen); | 1221 buf = alloc(buflen); |
1222 if (buf == NULL) | 1222 if (buf == NULL) |
1223 goto theend; | 1223 goto theend; |
1224 | 1224 |
1225 #ifdef UNIX | 1225 #ifdef UNIX |
1226 /* Temporarily chdir to /tmp, to avoid patching files in the current | 1226 /* Temporarily chdir to /tmp, to avoid patching files in the current |