summaryrefslogtreecommitdiff
path: root/libcr_ipc/chan.c
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-15 15:58:31 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-04-15 15:58:31 -0600
commitdb9a58f48c6eae16fbfcd89d59b09e123dbed54f (patch)
tree8e20dd9bc3ddf7b766714a57a9d33259c0b91165 /libcr_ipc/chan.c
parent03f29736acfcfaee6f263fd1461f96ccae3696da (diff)
libmisc: Add alloc.h to help detect wrong alloc sizes
Lo and behold, there was a mistake in chan.c.
Diffstat (limited to 'libcr_ipc/chan.c')
-rw-r--r--libcr_ipc/chan.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libcr_ipc/chan.c b/libcr_ipc/chan.c
index 6cbe890..f20b8a0 100644
--- a/libcr_ipc/chan.c
+++ b/libcr_ipc/chan.c
@@ -4,10 +4,10 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-#include <alloca.h> /* for alloca() */
#include <string.h> /* for memcpy() */
#include <libcr/coroutine.h> /* for cid_t, cr_* */
+#include <libmisc/alloc.h>
#include <libmisc/assert.h>
#include <libmisc/rand.h>
@@ -150,7 +150,7 @@ size_t cr_select_v(size_t arg_cnt, struct cr_select_arg arg_vec[]) {
struct cr_select_waiters waiters = {
.cnt = arg_cnt,
.args = arg_vec,
- .nodes = alloca(sizeof(struct cr_chan_waiter) * arg_cnt),
+ .nodes = stack_alloc(arg_cnt, struct _cr_chan_waiter_list_node),
};
for (size_t i = 0; i < arg_cnt; i++) {
waiters.nodes[i] = (struct _cr_chan_waiter_list_node){ .val = {