Commit aeffac30 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Rename msgbuffer_t to norns_msgbuffer_t

parent 37ff6de1
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -47,8 +47,8 @@
#include "log.h"

static int connect_to_daemon(const char* socket_path);
static int send_message(int conn, const msgbuffer_t* buffer);
static int recv_message(int conn, msgbuffer_t* buffer);
static int send_message(int conn, const norns_msgbuffer_t* buffer);
static int recv_message(int conn, norns_msgbuffer_t* buffer);
static ssize_t recv_data(int conn, void* data, size_t size);
static ssize_t send_data(int conn, const void* data, size_t size);
static void print_hex(void* buffer, size_t bytes) __attribute__((unused));
@@ -208,8 +208,8 @@ send_request(norns_rpc_type_t type, norns_response_t* resp, ...) {

    int res;
    int conn = -1;
    msgbuffer_t req_buf = MSGBUFFER_INIT();
    msgbuffer_t resp_buf = MSGBUFFER_INIT();
    norns_msgbuffer_t req_buf = MSGBUFFER_INIT();
    norns_msgbuffer_t resp_buf = MSGBUFFER_INIT();

    libcontext_t* ctx = get_context();

@@ -384,7 +384,7 @@ connect_to_daemon(const char* socket_path) {
}

static int
send_message(int conn, const msgbuffer_t* buffer) {
send_message(int conn, const norns_msgbuffer_t* buffer) {

    if(buffer == NULL || buffer->b_data == NULL || buffer->b_size == 0) {
        return -1;
@@ -412,7 +412,7 @@ send_message(int conn, const msgbuffer_t* buffer) {
}

static int 
recv_message(int conn, msgbuffer_t* buffer) {
recv_message(int conn, norns_msgbuffer_t* buffer) {

    // first of all read the message prefix and decode it 
    // so that we know how much data to receive
+2 −2
Original line number Diff line number Diff line
@@ -705,7 +705,7 @@ free_task_msg(Norns__Rpc__Request__Task* msg) {
}

int
pack_to_buffer(norns_rpc_type_t type, msgbuffer_t* buf, ...) {
pack_to_buffer(norns_rpc_type_t type, norns_msgbuffer_t* buf, ...) {

    Norns__Rpc__Request* req_msg = NULL;
    void* req_buf = NULL;
@@ -748,7 +748,7 @@ cleanup_on_error:
}

int
unpack_from_buffer(msgbuffer_t* buf, norns_response_t* response) {
unpack_from_buffer(norns_msgbuffer_t* buf, norns_response_t* response) {

    Norns__Rpc__Response* rpc_resp = NULL;
    void* resp_buf = buf->b_data;
+3 −3
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ typedef enum {
typedef struct {
    void* b_data;
    size_t b_size;
} msgbuffer_t;
} norns_msgbuffer_t;

#define MSGBUFFER_INIT() \
{   .b_data = 0, \
@@ -85,8 +85,8 @@ typedef struct {
    };
} norns_response_t;

int pack_to_buffer(norns_rpc_type_t type, msgbuffer_t* buf, ...);
int unpack_from_buffer(msgbuffer_t* buf, norns_response_t* response);
int pack_to_buffer(norns_rpc_type_t type, norns_msgbuffer_t* buf, ...);
int unpack_from_buffer(norns_msgbuffer_t* buf, norns_response_t* response);

#pragma GCC visibility pop