Skip to content

Commit

Permalink
A few minor vmodtool-rs cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
nyurik authored and gquintard committed Sep 13, 2024
1 parent 5c1a299 commit 459a7db
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/vmodtool-rs.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def rustFuncSig(self, vcc, t):
if t == "fini":
buf.write("(objp: *mut *mut crate::{0})".format(self.obj[1:]))
return buf.getvalue()
buf.write("(vrt_ctx: * mut varnish::vcl::boilerplate::vrt_ctx")
buf.write("(vrt_ctx: *mut varnish::vcl::boilerplate::vrt_ctx")
if t == "ini":
buf.write(", objp: *mut *mut crate::{0}".format(self.obj[1:]))
if t == "ini":
Expand Down Expand Up @@ -102,7 +102,7 @@ def rustfuncBody(self, vcc, t):

def rustEventFunc():
print('''
unsafe extern "C" fn vmod_c__event(vrt_ctx: * mut varnish::vcl::boilerplate::vrt_ctx, vp: *mut varnish::vcl::boilerplate::vmod_priv, ev: varnish::vcl::boilerplate::vcl_event_e) -> varnish::vcl::boilerplate::VCL_INT {
unsafe extern "C" fn vmod_c__event(vrt_ctx: *mut varnish::vcl::boilerplate::vrt_ctx, vp: *mut varnish::vcl::boilerplate::vmod_priv, ev: varnish::vcl::boilerplate::vcl_event_e) -> varnish::vcl::boilerplate::VCL_INT {
let mut ctx = Ctx::from_ptr(vrt_ctx);
let event = Event::new(ev);
match crate::event(
Expand Down Expand Up @@ -147,9 +147,9 @@ def runmain(inputvcc, rstdir, abi):
use std::ptr;
use std::ffi::*;
use std::boxed::Box;
use varnish::vcl::ctx::{{ Ctx, Event }};
use varnish::vcl::convert::{{IntoRust, IntoVCL, IntoResult, VCLDefault}};
""".format(modname=v.modname))
use varnish::vcl::ctx::{Ctx, Event};
use varnish::vcl::convert::{IntoRust, IntoVCL, IntoResult, VCLDefault};
""")

# C stuff is done, get comfortable with our own types
for i in vmodtool.CTYPES:
Expand Down Expand Up @@ -180,7 +180,7 @@ def rustMemberDeclare(name, func, t):

if isinstance(i, vmodtool.EventStanza):
print(
'''\t_event: Option<unsafe extern "C" fn(vrt_ctx: * mut varnish::vcl::boilerplate::vrt_ctx, vp: *mut varnish::vcl::boilerplate::vmod_priv, ev: varnish::vcl::boilerplate::vcl_event_e) -> varnish::vcl::boilerplate::VCL_INT>,''')
'''\t_event: Option<unsafe extern "C" fn(vrt_ctx: *mut varnish::vcl::boilerplate::vrt_ctx, vp: *mut varnish::vcl::boilerplate::vmod_priv, ev: varnish::vcl::boilerplate::vcl_event_e) -> varnish::vcl::boilerplate::VCL_INT>,''')
elif isinstance(i, vmodtool.FunctionStanza):
rustMemberDeclare(i.proto.cname(), i.proto, "func")
elif isinstance(i, vmodtool.ObjectStanza):
Expand Down

0 comments on commit 459a7db

Please sign in to comment.