#include <ucode/module.h>
#include "udebug-pcap.h"
-static uc_resource_type_t *wbuf_type, *snapshot_type, *pcap_type;
static struct udebug u;
struct uc_pcap {
if (!s)
return NULL;
- return uc_resource_new(snapshot_type, s);
+ return ucv_resource_create(vm, "udebug.snapshot", s);
}
static uc_value_t *
}
static uc_value_t *
-uc_debug_pcap_init(int fd, uc_value_t *args)
+uc_debug_pcap_init(uc_vm_t *vm, int fd, uc_value_t *args)
{
struct uc_pcap *p;
FILE *f;
uc_udebug_pcap_init(p, args);
pcap_block_write_file(p->f);
- return uc_resource_new(pcap_type, p);
+ return ucv_resource_create(vm, "udebug.pcap", p);
}
static uc_value_t *
} else if (!file)
fd = STDOUT_FILENO;
- return uc_debug_pcap_init(fd, args);
+ return uc_debug_pcap_init(vm, fd, args);
}
static uc_value_t *
fd = usock(USOCK_UDP, ucv_string_get(host), port_str);
- return uc_debug_pcap_init(fd, args);
+ return uc_debug_pcap_init(vm, fd, args);
}
static struct udebug_snapshot *
udebug_buf_add(&u, buf, meta);
- return uc_resource_new(wbuf_type, buf);
+ return ucv_resource_create(vm, "udebug.wbuf", buf);
}
static void wbuf_free(void *ptr)
return;
udebug_buf_free(ptr);
- free(ptr);
}
static uc_value_t *
{
uc_function_list_register(scope, global_fns);
- wbuf_type = uc_type_declare(vm, "udebug.wbuf", wbuf_fns, wbuf_free);
+ uc_type_declare(vm, "udebug.wbuf", wbuf_fns, wbuf_free);
uc_type_declare(vm, "udebug.rbuf", rbuf_fns, rbuf_free);
- snapshot_type = uc_type_declare(vm, "udebug.snapshot", snapshot_fns, free);
- pcap_type = uc_type_declare(vm, "udebug.pcap", pcap_fns, uc_udebug_pcap_free);
+ uc_type_declare(vm, "udebug.snapshot", snapshot_fns, free);
+ uc_type_declare(vm, "udebug.pcap", pcap_fns, uc_udebug_pcap_free);
}