comparison src/userfunc.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 98393772bddd
children 695d9ef00b03
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
555 STRCPY(fname_buf + i, name + llen); 555 STRCPY(fname_buf + i, name + llen);
556 fname = fname_buf; 556 fname = fname_buf;
557 } 557 }
558 else 558 else
559 { 559 {
560 fname = alloc((unsigned)(i + STRLEN(name + llen) + 1)); 560 fname = alloc(i + STRLEN(name + llen) + 1);
561 if (fname == NULL) 561 if (fname == NULL)
562 *error = ERROR_OTHER; 562 *error = ERROR_OTHER;
563 else 563 else
564 { 564 {
565 *tofree = fname; 565 *tofree = fname;
976 } 976 }
977 977
978 /* need space for function name + ("function " + 3) or "[number]" */ 978 /* need space for function name + ("function " + 3) or "[number]" */
979 len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name)) 979 len = (save_sourcing_name == NULL ? 0 : STRLEN(save_sourcing_name))
980 + STRLEN(fp->uf_name) + 20; 980 + STRLEN(fp->uf_name) + 20;
981 sourcing_name = alloc((unsigned)len); 981 sourcing_name = alloc(len);
982 if (sourcing_name != NULL) 982 if (sourcing_name != NULL)
983 { 983 {
984 if (save_sourcing_name != NULL 984 if (save_sourcing_name != NULL
985 && STRNCMP(save_sourcing_name, "function ", 9) == 0) 985 && STRNCMP(save_sourcing_name, "function ", 9) == 0)
986 sprintf((char *)sourcing_name, "%s[%d]..", 986 sprintf((char *)sourcing_name, "%s[%d]..",
1930 semsg(_("E884: Function name cannot contain a colon: %s"), start); 1930 semsg(_("E884: Function name cannot contain a colon: %s"), start);
1931 goto theend; 1931 goto theend;
1932 } 1932 }
1933 } 1933 }
1934 1934
1935 name = alloc((unsigned)(len + lead + 1)); 1935 name = alloc(len + lead + 1);
1936 if (name != NULL) 1936 if (name != NULL)
1937 { 1937 {
1938 if (lead > 0) 1938 if (lead > 0)
1939 { 1939 {
1940 name[0] = K_SPECIAL; 1940 name[0] = K_SPECIAL;
2785 2785
2786 todo = (int)func_hashtab.ht_used; 2786 todo = (int)func_hashtab.ht_used;
2787 if (todo == 0) 2787 if (todo == 0)
2788 return; /* nothing to dump */ 2788 return; /* nothing to dump */
2789 2789
2790 sorttab = (ufunc_T **)alloc((unsigned)(sizeof(ufunc_T *) * todo)); 2790 sorttab = (ufunc_T **)alloc(sizeof(ufunc_T *) * todo);
2791 2791
2792 for (hi = func_hashtab.ht_array; todo > 0; ++hi) 2792 for (hi = func_hashtab.ht_array; todo > 0; ++hi)
2793 { 2793 {
2794 if (!HASHITEM_EMPTY(hi)) 2794 if (!HASHITEM_EMPTY(hi))
2795 { 2795 {