aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2019-06-04 22:17:17 -0400
committerDeterminant <[email protected]>2019-06-04 22:17:17 -0400
commitdab48a1825aed9c810ce83ea8054fa435ecb41be (patch)
treee0a3f9587e3606350dedb291a22a70a9ba5b7e44 /src
parentda42ddf96c78a73b4cf5f8854e98e009f4f174a4 (diff)
...
Diffstat (limited to 'src')
-rw-r--r--src/event.cpp7
-rw-r--r--src/msg.cpp6
-rw-r--r--src/netaddr.cpp14
-rw-r--r--src/network.cpp13
-rw-r--r--src/stream.cpp7
-rw-r--r--src/type.cpp17
6 files changed, 32 insertions, 32 deletions
diff --git a/src/event.cpp b/src/event.cpp
index 050914c..0daa498 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -1,3 +1,4 @@
+#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/event.h"
@@ -11,13 +12,13 @@ void eventcontext_stop(eventcontext_t *self) { return self->stop(); }
void eventcontext_free(eventcontext_t *self) { delete self; }
-void sigev_new(const eventcontext_t *self, sigev_callback_t cb) {
- return new SigEvent(*self, cb);
+sigev_t *sigev_new(const eventcontext_t *self, sigev_callback_t cb) {
+ return new sigev_t(*self, cb);
}
void sigev_add(sigev_t *self, int sig) { self->add(sig); }
-void sigev_delete() { delete self; }
+void sigev_delete(sigev_t *self) { delete self; }
}
diff --git a/src/msg.cpp b/src/msg.cpp
index d395d2b..caee1c7 100644
--- a/src/msg.cpp
+++ b/src/msg.cpp
@@ -1,11 +1,13 @@
+#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/msg.h"
extern "C" {
msg_t *msg_new(_opcode_t opcode, bytearray_t *_moved_payload) {
- auto res = new msg_t(opcode, *payload);
- bytearray_free(payload);
+ auto res = new msg_t(opcode, std::move(*_moved_payload));
+ bytearray_free(_moved_payload);
+ return res;
}
datastream_t *msg_get_payload(const msg_t *msg) {
diff --git a/src/netaddr.cpp b/src/netaddr.cpp
index a3a54bf..1803629 100644
--- a/src/netaddr.cpp
+++ b/src/netaddr.cpp
@@ -1,22 +1,20 @@
+#include "salticidae/config.h"
+#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/netaddr.h"
-using namespace salticidae;
-
-#ifdef __cplusplus
-
extern "C" {
-netaddr_t *netaddr_new() { return new NetAddr(); }
+netaddr_t *netaddr_new() { return new netaddr_t(); }
netaddr_t *netaddr_new_from_ip_port(uint32_t ip, uint16_t port) {
- return new NetAddr(ip, port);
+ return new netaddr_t(ip, port);
}
netaddr_t *netaddr_new_from_sip_port(const char *ip, uint16_t port) {
- return new NetAddr(ip, port);
+ return new netaddr_t(ip, port);
}
netaddr_t *netaddr_new_from_sipport(const char *ip_port_addr) {
- return new NetAddr(ip_port_addr);
+ return new netaddr_t(ip_port_addr);
}
bool netaddr_is_eq(const netaddr_t *a, const netaddr_t *b) {
diff --git a/src/network.cpp b/src/network.cpp
index d2d9615..58b3ce1 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -1,3 +1,4 @@
+#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/network.h"
@@ -56,13 +57,19 @@ msgnetwork_t *msgnetwork_conn_get_net(const msgnetwork_conn_t *conn) {
void msgnetwork_start(msgnetwork_t *self) { self->start(); }
msgnetwork_conn_mode_t msgnetwork_conn_get_mode(const msgnetwork_conn_t *conn) {
- return conn->get_mode();
+ return (msgnetwork_conn_mode_t)(*conn)->get_mode();
}
-netaddr_t msgnetwork_conn_get_addr(const msgnetwork_conn_t *conn) {
- return new netaddr_t(conn->get_addr());
+netaddr_t *msgnetwork_conn_get_addr(const msgnetwork_conn_t *conn) {
+ return new netaddr_t((*conn)->get_addr());
}
+msgnetwork_config_t *msgnetwork_config_new() {
+ return new msgnetwork_config_t();
+}
+
+void msgnetwork_config_free(msgnetwork_config_t *self) { delete self; }
+
}
#endif
diff --git a/src/stream.cpp b/src/stream.cpp
index ec1d5da..2fe1a11 100644
--- a/src/stream.cpp
+++ b/src/stream.cpp
@@ -1,8 +1,7 @@
+#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/stream.h"
-using namespace salticidae;
-
extern "C" {
uint256_t *uint256_new() { return new uint256_t(); }
@@ -23,9 +22,9 @@ void uint256_unserialize(uint256_t *self, datastream_t *s) {
self->unserialize(*s);
}
-datastream_t *datastream_new() { return new DataStream(); }
+datastream_t *datastream_new() { return new datastream_t(); }
datastream_t *datastream_new_from_bytes(const uint8_t *begin, const uint8_t *end) {
- return new DataStream(begin, end);
+ return new datastream_t(begin, end);
}
void datastream_assign_by_copy(datastream_t *dst, const datastream_t *src) {
diff --git a/src/type.cpp b/src/type.cpp
index 1b02933..90d5055 100644
--- a/src/type.cpp
+++ b/src/type.cpp
@@ -1,23 +1,16 @@
+#include "salticidae/config.h"
#ifdef SALTICIDAE_CBINDINGS
#include "salticidae/type.h"
extern "C" {
-bytearray_t *bytearray_new() {
- return new bytearray_t();
-}
+bytearray_t *bytearray_new() { return new bytearray_t(); }
-uint8_t *bytearray_data(bytearray_t *arr) {
- return &(*arr)[0];
-}
+uint8_t *bytearray_data(bytearray_t *arr) { return &(*arr)[0]; }
-size_t bytearray_size(bytearray_t *arr) {
- return arr->size();
-}
+size_t bytearray_size(bytearray_t *arr) { return arr->size(); }
-void bytearray_free(bytearray_t *arr) {
- delete arr;
-}
+void bytearray_free(bytearray_t *arr) { delete arr; }
}