Skip to content

Commit 5b79069

Browse files
committed
refactor: reduce VRBT codegen bloat
1 parent a96bc4e commit 5b79069

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

src/proxy_wasm.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,12 @@ struct vwasm_http_call_entry {
154154

155155
VRBT_HEAD(vwasm_http_call_tree, vwasm_http_call_entry);
156156

157-
static inline int
157+
int
158158
vwasm_http_call_cmp(const struct vwasm_http_call_entry *a,
159159
const struct vwasm_http_call_entry *b)
160-
{
161-
if (a->token_id < b->token_id)
162-
return (-1);
163-
if (a->token_id > b->token_id)
164-
return (1);
165-
return (0);
166-
}
167-
168-
VRBT_GENERATE_STATIC(vwasm_http_call_tree, vwasm_http_call_entry, entry,
160+
;
161+
162+
VRBT_PROTOTYPE(vwasm_http_call_tree, vwasm_http_call_entry, entry,
169163
vwasm_http_call_cmp)
170164

171165
/* ----------------------------------------------------------------

src/proxy_wasm_http.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@
3434
#include "wasm_engine.h"
3535
#include "http_pool.h"
3636

37+
int
38+
vwasm_http_call_cmp(const struct vwasm_http_call_entry *a,
39+
const struct vwasm_http_call_entry *b)
40+
{
41+
if (a->token_id < b->token_id)
42+
return (-1);
43+
if (a->token_id > b->token_id)
44+
return (1);
45+
return (0);
46+
}
47+
48+
VRBT_GENERATE(vwasm_http_call_tree, vwasm_http_call_entry, entry,
49+
vwasm_http_call_cmp)
50+
3751
#define PW_HTTP_MAX_RESPONSE (256 * 1024) /* 256 KiB max response */
3852

3953
/* ----------------------------------------------------------------

0 commit comments

Comments
 (0)