Mercurial > vim
comparison src/gui_mac.c @ 16825:ce04ebdf26b8 v8.1.1414
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
commit https://github.com/vim/vim/commit/c799fe206e61f2e2c1231bc46cbe4bb354f3da69
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue May 28 23:08:19 2019 +0200
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Problem: Alloc() returning "char_u *" causes a lot of type casts.
Solution: Have it return "void *". (Mike Williams) Define ALLOC_ONE() to
check the simple allocations.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 28 May 2019 23:15:10 +0200 |
parents | 695d9ef00b03 |
children | 3147c7c2e86b |
comparison
equal
deleted
inserted
replaced
16824:1f6bb29738d2 | 16825:ce04ebdf26b8 |
---|---|
534 *error = AECountItems(theList, numFiles); | 534 *error = AECountItems(theList, numFiles); |
535 if (*error) | 535 if (*error) |
536 return fnames; | 536 return fnames; |
537 | 537 |
538 /* Allocate the pointer list */ | 538 /* Allocate the pointer list */ |
539 fnames = (char_u **) alloc(*numFiles * sizeof(char_u *)); | 539 fnames = ALLOC_MULT(char_u *, *numFiles); |
540 | 540 |
541 /* Empty out the list */ | 541 /* Empty out the list */ |
542 for (fileCount = 0; fileCount < *numFiles; fileCount++) | 542 for (fileCount = 0; fileCount < *numFiles; fileCount++) |
543 fnames[fileCount] = NULL; | 543 fnames[fileCount] = NULL; |
544 | 544 |
2103 | 2103 |
2104 if (noErr != GetEventParameter(theEvent, kEventParamTextInputSendText, | 2104 if (noErr != GetEventParameter(theEvent, kEventParamTextInputSendText, |
2105 typeUnicodeText, NULL, 0, &actualSize, NULL)) | 2105 typeUnicodeText, NULL, 0, &actualSize, NULL)) |
2106 return eventNotHandledErr; | 2106 return eventNotHandledErr; |
2107 | 2107 |
2108 text = (UniChar *)alloc(actualSize); | 2108 text = alloc(actualSize); |
2109 if (!text) | 2109 if (!text) |
2110 return eventNotHandledErr; | 2110 return eventNotHandledErr; |
2111 | 2111 |
2112 err = GetEventParameter(theEvent, kEventParamTextInputSendText, | 2112 err = GetEventParameter(theEvent, kEventParamTextInputSendText, |
2113 typeUnicodeText, NULL, actualSize, NULL, text); | 2113 typeUnicodeText, NULL, actualSize, NULL, text); |
2973 modifiers = EventModifiers2VimMouseModifiers(mouseUpModifiers); | 2973 modifiers = EventModifiers2VimMouseModifiers(mouseUpModifiers); |
2974 CountDragItems(theDrag, &countItem); | 2974 CountDragItems(theDrag, &countItem); |
2975 count = countItem; | 2975 count = countItem; |
2976 } | 2976 } |
2977 | 2977 |
2978 fnames = (char_u **)alloc(count * sizeof(char_u *)); | 2978 fnames = ALLOC_MULT(char_u *, count); |
2979 if (fnames == NULL) | 2979 if (fnames == NULL) |
2980 return dragNotAcceptedErr; | 2980 return dragNotAcceptedErr; |
2981 | 2981 |
2982 /* Get file names dropped */ | 2982 /* Get file names dropped */ |
2983 for (i = j = 0; i < count; ++i) | 2983 for (i = j = 0; i < count; ++i) |