From e89a49490c3109d42d29d6b9f57eaa373bb80b58 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 11 Jun 2018 22:19:34 +0200 Subject: Clarify memory guarantees of deno_buf --- deno2/include/deno.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'deno2/include/deno.h') diff --git a/deno2/include/deno.h b/deno2/include/deno.h index 63f26ba8c..b8d4e59a4 100644 --- a/deno2/include/deno.h +++ b/deno2/include/deno.h @@ -10,14 +10,16 @@ extern "C" { // Data that gets transmitted. typedef struct { - void* data; + const char* data; size_t len; } deno_buf; struct deno_s; typedef struct deno_s Deno; -// The callback from V8 when data is sent. +// A callback to receive a message from deno_pub javascript call. +// buf is valid only for the lifetime of the call. +// The returned deno_buf is returned from deno_pub in javascript. typedef deno_buf (*deno_sub_cb)(Deno* d, const char* channel, deno_buf buf); void deno_init(); -- cgit v1.2.3