mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
nodes: refactor NULL => nullptr
This commit is contained in:
parent
5485bf4be3
commit
6cecdf4b81
18 changed files with 166 additions and 166 deletions
|
@ -34,9 +34,9 @@ static void amqp_default_ssl_info(struct amqp_ssl_info *s)
|
|||
{
|
||||
s->verify_peer = 1;
|
||||
s->verify_hostname = 1;
|
||||
s->client_key = NULL;
|
||||
s->client_cert = NULL;
|
||||
s->ca_cert = NULL;
|
||||
s->client_key = nullptr;
|
||||
s->client_cert = nullptr;
|
||||
s->ca_cert = nullptr;
|
||||
}
|
||||
|
||||
static amqp_bytes_t amqp_bytes_strdup(const char *str)
|
||||
|
@ -58,12 +58,12 @@ static amqp_connection_state_t amqp_connect(struct amqp_connection_info *ci, str
|
|||
|
||||
conn = amqp_new_connection();
|
||||
if (!conn)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (ci->ssl) {
|
||||
sock = amqp_ssl_socket_new(conn);
|
||||
if (!sock)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
amqp_ssl_socket_set_verify_peer(sock, ssl->verify_peer);
|
||||
amqp_ssl_socket_set_verify_hostname(sock, ssl->verify_hostname);
|
||||
|
@ -77,21 +77,21 @@ static amqp_connection_state_t amqp_connect(struct amqp_connection_info *ci, str
|
|||
else {
|
||||
sock = amqp_tcp_socket_new(conn);
|
||||
if (!sock)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ret = amqp_socket_open(sock, ci->host, ci->port);
|
||||
if (ret != AMQP_STATUS_OK)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
rep = amqp_login(conn, ci->vhost, 0, 131072, 0, AMQP_SASL_METHOD_PLAIN, ci->user, ci->password);
|
||||
if (rep.reply_type != AMQP_RESPONSE_NORMAL)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
amqp_channel_open(conn, 1);
|
||||
rep = amqp_get_rpc_reply(conn);
|
||||
if (rep.reply_type != AMQP_RESPONSE_NORMAL)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
return conn;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ int amqp_parse(struct node *n, json_t *json)
|
|||
|
||||
int port = 5672;
|
||||
const char *format = "json";
|
||||
const char *uri = NULL;
|
||||
const char *uri = nullptr;
|
||||
const char *host = "localhost";
|
||||
const char *vhost = "/";
|
||||
const char *username = "guest";
|
||||
|
@ -127,7 +127,7 @@ int amqp_parse(struct node *n, json_t *json)
|
|||
|
||||
json_error_t err;
|
||||
|
||||
json_t *json_ssl = NULL;
|
||||
json_t *json_ssl = nullptr;
|
||||
|
||||
/* Default values */
|
||||
amqp_default_ssl_info(&a->ssl_info);
|
||||
|
@ -162,9 +162,9 @@ int amqp_parse(struct node *n, json_t *json)
|
|||
error("Failed to parse URI '%s' of node %s", uri, node_name(n));
|
||||
|
||||
if (json_ssl) {
|
||||
const char *ca_cert = NULL;
|
||||
const char *client_cert = NULL;
|
||||
const char *client_key = NULL;
|
||||
const char *ca_cert = nullptr;
|
||||
const char *client_cert = nullptr;
|
||||
const char *client_key = nullptr;
|
||||
|
||||
ret = json_unpack_ex(json_ssl, &err, 0, "{ s?: b, s?: b, s?: s, s?: s, s?: s }",
|
||||
"verify_peer", &a->ssl_info.verify_peer,
|
||||
|
@ -197,7 +197,7 @@ char * amqp_print(struct node *n)
|
|||
{
|
||||
struct amqp *a = (struct amqp *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "format=%s, uri=%s://%s:%s@%s:%d%s, exchange=%s, routing_key=%s",
|
||||
format_type_name(a->format),
|
||||
|
@ -270,7 +270,7 @@ int amqp_start(struct node *n)
|
|||
return -1;
|
||||
|
||||
queue = amqp_bytes_malloc_dup(r->queue);
|
||||
if (queue.bytes == NULL)
|
||||
if (queue.bytes == nullptr)
|
||||
return -1;
|
||||
|
||||
/* Bind queue to exchange */
|
||||
|
@ -317,11 +317,11 @@ int amqp_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rel
|
|||
amqp_envelope_t env;
|
||||
amqp_rpc_reply_t rep;
|
||||
|
||||
rep = amqp_consume_message(a->consumer, &env, NULL, 0);
|
||||
rep = amqp_consume_message(a->consumer, &env, nullptr, 0);
|
||||
if (rep.reply_type != AMQP_RESPONSE_NORMAL)
|
||||
return -1;
|
||||
|
||||
ret = io_sscan(&a->io, static_cast<char *>(env.message.body.bytes), env.message.body.len, NULL, smps, cnt);
|
||||
ret = io_sscan(&a->io, static_cast<char *>(env.message.body.bytes), env.message.body.len, nullptr, smps, cnt);
|
||||
|
||||
amqp_destroy_envelope(&env);
|
||||
|
||||
|
@ -348,7 +348,7 @@ int amqp_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re
|
|||
ret = amqp_basic_publish(a->producer, 1,
|
||||
a->exchange,
|
||||
a->routing_key,
|
||||
0, 0, NULL, message);
|
||||
0, 0, nullptr, message);
|
||||
|
||||
if (ret != AMQP_STATUS_OK)
|
||||
return -1;
|
||||
|
|
|
@ -71,10 +71,10 @@ static int comedi_parse_direction(struct comedi *c, struct comedi_direction *d,
|
|||
}
|
||||
|
||||
d->chanlist = (unsigned int*) alloc(d->chanlist_len * sizeof(*d->chanlist));
|
||||
assert(d->chanlist != NULL);
|
||||
assert(d->chanlist != nullptr);
|
||||
|
||||
d->chanspecs = (comedi_chanspec *) alloc(d->chanlist_len * sizeof(*d->chanspecs));
|
||||
assert(d->chanspecs != NULL);
|
||||
assert(d->chanspecs != nullptr);
|
||||
|
||||
json_array_foreach(json_chans, i, json_chan) {
|
||||
int num, range, aref;
|
||||
|
@ -236,7 +236,7 @@ static int comedi_start_in(struct node *n)
|
|||
/* Be prepared to consume one entire buffer */
|
||||
c->buf = (char *) alloc(c->in.buffer_size);
|
||||
c->bufptr = c->buf;
|
||||
assert(c->bufptr != NULL);
|
||||
assert(c->bufptr != nullptr);
|
||||
|
||||
info("Compiled for kernel read() interface");
|
||||
#else
|
||||
|
@ -326,7 +326,7 @@ static int comedi_start_out(struct node *n)
|
|||
const size_t local_buffer_size = d->sample_size * d->chanlist_len;
|
||||
d->buffer = (char *) alloc(local_buffer_size);
|
||||
d->bufptr = d->buffer;
|
||||
assert(d->buffer != NULL);
|
||||
assert(d->buffer != nullptr);
|
||||
|
||||
/* Initialize local buffer used for write() syscalls */
|
||||
for (unsigned channel = 0; channel < d->chanlist_len; channel++) {
|
||||
|
@ -392,8 +392,8 @@ int comedi_parse(struct node *n, json_t *cfg)
|
|||
|
||||
const char *device;
|
||||
|
||||
json_t *json_in = NULL;
|
||||
json_t *json_out = NULL;
|
||||
json_t *json_in = nullptr;
|
||||
json_t *json_out = nullptr;
|
||||
json_error_t err;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: s, s?: o, s?: o }",
|
||||
|
@ -404,11 +404,11 @@ int comedi_parse(struct node *n, json_t *cfg)
|
|||
if (ret)
|
||||
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
|
||||
|
||||
c->in.present = json_in != NULL;
|
||||
c->in.present = json_in != nullptr;
|
||||
c->in.enabled = false;
|
||||
c->in.running = false;
|
||||
|
||||
c->out.present = json_out != NULL;
|
||||
c->out.present = json_out != nullptr;
|
||||
c->out.enabled = false;
|
||||
c->out.running = false;
|
||||
|
||||
|
@ -433,7 +433,7 @@ char * comedi_print(struct node *n)
|
|||
{
|
||||
struct comedi *c = (struct comedi *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
const char *board = comedi_get_board_name(c->dev);
|
||||
const char *driver = comedi_get_driver_name(c->dev);
|
||||
|
@ -478,7 +478,7 @@ int comedi_start(struct node *n)
|
|||
|
||||
#if !COMEDI_USE_READ
|
||||
info("Mapping Comedi buffer of %d bytes", c->in.buffer_size);
|
||||
c->map = mmap(NULL, c->in.buffer_size, PROT_READ, MAP_SHARED, comedi_fileno(c->dev), 0);
|
||||
c->map = mmap(nullptr, c->in.buffer_size, PROT_READ, MAP_SHARED, comedi_fileno(c->dev), 0);
|
||||
if (c->map == MAP_FAILED)
|
||||
error("Failed to map comedi buffer of node '%s'", node_name(n));
|
||||
|
||||
|
@ -533,7 +533,7 @@ int comedi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r
|
|||
timeout.tv_sec = 0;
|
||||
timeout.tv_usec = 5000;
|
||||
|
||||
ret = select(comedi_fileno(c->dev) + 1, &rdset, NULL, NULL, &timeout);
|
||||
ret = select(comedi_fileno(c->dev) + 1, &rdset, nullptr, nullptr, &timeout);
|
||||
if (ret < 0)
|
||||
error("select");
|
||||
else if (ret == 0) /* hit timeout */
|
||||
|
|
|
@ -81,10 +81,10 @@ int file_parse(struct node *n, json_t *cfg)
|
|||
int ret;
|
||||
json_error_t err;
|
||||
|
||||
const char *uri_tmpl = NULL;
|
||||
const char *uri_tmpl = nullptr;
|
||||
const char *format = "villas.human";
|
||||
const char *eof = NULL;
|
||||
const char *epoch = NULL;
|
||||
const char *eof = nullptr;
|
||||
const char *epoch = nullptr;
|
||||
double epoch_flt = 0;
|
||||
|
||||
/* Default values */
|
||||
|
@ -112,7 +112,7 @@ int file_parse(struct node *n, json_t *cfg)
|
|||
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
|
||||
|
||||
f->epoch = time_from_double(epoch_flt);
|
||||
f->uri_tmpl = uri_tmpl ? strdup(uri_tmpl) : NULL;
|
||||
f->uri_tmpl = uri_tmpl ? strdup(uri_tmpl) : nullptr;
|
||||
|
||||
f->format = format_type_lookup(format);
|
||||
if (!f->format)
|
||||
|
@ -152,10 +152,10 @@ int file_parse(struct node *n, json_t *cfg)
|
|||
char * file_print(struct node *n)
|
||||
{
|
||||
struct file *f = (struct file *) n->_vd;
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
const char *epoch_str = NULL;
|
||||
const char *eof_str = NULL;
|
||||
const char *epoch_str = nullptr;
|
||||
const char *eof_str = nullptr;
|
||||
|
||||
switch (f->epoch_mode) {
|
||||
case file::epoch::DIRECT:
|
||||
|
@ -286,13 +286,13 @@ int file_start(struct node *n)
|
|||
return ret;
|
||||
|
||||
if (f->buffer_size_in) {
|
||||
ret = setvbuf(f->io.in.stream.std, NULL, _IOFBF, f->buffer_size_in);
|
||||
ret = setvbuf(f->io.in.stream.std, nullptr, _IOFBF, f->buffer_size_in);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (f->buffer_size_out) {
|
||||
ret = setvbuf(f->io.out.stream.std, NULL, _IOFBF, f->buffer_size_out);
|
||||
ret = setvbuf(f->io.out.stream.std, nullptr, _IOFBF, f->buffer_size_out);
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ static void * iec61850_thread(void *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const struct iec61850_type_descriptor * iec61850_lookup_type(const char *name)
|
||||
|
@ -94,7 +94,7 @@ const struct iec61850_type_descriptor * iec61850_lookup_type(const char *name)
|
|||
return &type_descriptors[i];
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int iec61850_parse_signals(json_t *json_signals, struct vlist *signals, struct vlist *node_signals)
|
||||
|
@ -186,7 +186,7 @@ int iec61850_type_start(struct super_node *sn)
|
|||
|
||||
hset = EthernetHandleSet_new();
|
||||
|
||||
ret = pthread_create(&thread, NULL, iec61850_thread, NULL);
|
||||
ret = pthread_create(&thread, nullptr, iec61850_thread, nullptr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -210,7 +210,7 @@ int iec61850_type_stop()
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_join(thread, NULL);
|
||||
ret = pthread_join(thread, nullptr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -281,7 +281,7 @@ struct iec61850_receiver * iec61850_receiver_lookup(enum iec61850_receiver::type
|
|||
return r;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
struct iec61850_receiver * iec61850_receiver_create(enum iec61850_receiver::type t, const char *intf)
|
||||
|
@ -293,7 +293,7 @@ struct iec61850_receiver * iec61850_receiver_create(enum iec61850_receiver::type
|
|||
if (!r) {
|
||||
r = (struct iec61850_receiver *) alloc(sizeof(struct iec61850_receiver));
|
||||
if (!r)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
r->interface = strdup(intf);
|
||||
r->type = t;
|
||||
|
|
|
@ -140,14 +140,14 @@ int iec61850_sv_parse(struct node *n, json_t *json)
|
|||
int ret;
|
||||
struct iec61850_sv *i = (struct iec61850_sv *) n->_vd;
|
||||
|
||||
const char *dst_address = NULL;
|
||||
const char *interface = NULL;
|
||||
const char *svid = NULL;
|
||||
const char *smpmod = NULL;
|
||||
const char *dst_address = nullptr;
|
||||
const char *interface = nullptr;
|
||||
const char *svid = nullptr;
|
||||
const char *smpmod = nullptr;
|
||||
|
||||
json_t *json_in = NULL;
|
||||
json_t *json_out = NULL;
|
||||
json_t *json_signals = NULL;
|
||||
json_t *json_in = nullptr;
|
||||
json_t *json_out = nullptr;
|
||||
json_t *json_signals = nullptr;
|
||||
json_error_t err;
|
||||
|
||||
/* Default values */
|
||||
|
@ -212,7 +212,7 @@ int iec61850_sv_parse(struct node *n, json_t *json)
|
|||
error("Invalid value '%s' for setting 'smpmod'", smpmod);
|
||||
}
|
||||
|
||||
i->out.svid = svid ? strdup(svid) : NULL;
|
||||
i->out.svid = svid ? strdup(svid) : nullptr;
|
||||
|
||||
ret = iec61850_parse_signals(json_signals, &i->out.signals, &n->out.signals);
|
||||
if (ret <= 0)
|
||||
|
@ -224,7 +224,7 @@ int iec61850_sv_parse(struct node *n, json_t *json)
|
|||
if (json_in) {
|
||||
i->in.enabled = true;
|
||||
|
||||
json_signals = NULL;
|
||||
json_signals = nullptr;
|
||||
ret = json_unpack_ex(json_in, &err, 0, "{ s: o }",
|
||||
"signals", &json_signals
|
||||
);
|
||||
|
@ -273,7 +273,7 @@ int iec61850_sv_start(struct node *n)
|
|||
|
||||
/* Initialize publisher */
|
||||
if (i->out.enabled) {
|
||||
i->out.publisher = SVPublisher_create(NULL, i->interface);
|
||||
i->out.publisher = SVPublisher_create(nullptr, i->interface);
|
||||
i->out.asdu = SVPublisher_addASDU(i->out.publisher, i->out.svid, node_name_short(n), i->out.confrev);
|
||||
|
||||
for (unsigned k = 0; k < vlist_length(&i->out.signals); k++) {
|
||||
|
|
|
@ -73,13 +73,13 @@ static void ib_build_ibv(struct node *n)
|
|||
debug(LOG_IB | 1, "Starting to build IBV components");
|
||||
|
||||
/* Create completion queues (No completion channel!) */
|
||||
ib->ctx.recv_cq = ibv_create_cq(ib->ctx.id->verbs, ib->recv_cq_size, NULL, NULL, 0);
|
||||
ib->ctx.recv_cq = ibv_create_cq(ib->ctx.id->verbs, ib->recv_cq_size, nullptr, nullptr, 0);
|
||||
if (!ib->ctx.recv_cq)
|
||||
error("Could not create receive completion queue in node %s", node_name(n));
|
||||
|
||||
debug(LOG_IB | 3, "Created receive Completion Queue");
|
||||
|
||||
ib->ctx.send_cq = ibv_create_cq(ib->ctx.id->verbs, ib->send_cq_size, NULL, NULL, 0);
|
||||
ib->ctx.send_cq = ibv_create_cq(ib->ctx.id->verbs, ib->send_cq_size, nullptr, nullptr, 0);
|
||||
if (!ib->ctx.send_cq)
|
||||
error("Could not create send completion queue in node %s", node_name(n));
|
||||
|
||||
|
@ -173,7 +173,7 @@ int ib_parse(struct node *n, json_t *cfg)
|
|||
struct infiniband *ib = (struct infiniband *) n->_vd;
|
||||
|
||||
int ret;
|
||||
char *local = NULL, *remote = NULL, *lasts;
|
||||
char *local = nullptr, *remote = nullptr, *lasts;
|
||||
const char *transport_mode = "RC";
|
||||
int timeout = 1000;
|
||||
int recv_cq_size = 128;
|
||||
|
@ -188,8 +188,8 @@ int ib_parse(struct node *n, json_t *cfg)
|
|||
int use_fallback = 1;
|
||||
|
||||
/* Parse JSON files and copy to local variables */
|
||||
json_t *json_in = NULL;
|
||||
json_t *json_out = NULL;
|
||||
json_t *json_in = nullptr;
|
||||
json_t *json_out = nullptr;
|
||||
json_error_t err;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s?: o, s?: o, s?: s }",
|
||||
|
@ -254,9 +254,9 @@ int ib_parse(struct node *n, json_t *cfg)
|
|||
|
||||
/* Translate IP:PORT to a struct addrinfo */
|
||||
char *ip_adr = strtok_r(local, ":", &lasts);
|
||||
char *port = strtok_r(NULL, ":", &lasts);
|
||||
char *port = strtok_r(nullptr, ":", &lasts);
|
||||
|
||||
ret = getaddrinfo(ip_adr, port, NULL, &ib->conn.src_addr);
|
||||
ret = getaddrinfo(ip_adr, port, nullptr, &ib->conn.src_addr);
|
||||
if (ret)
|
||||
error("Failed to resolve local address '%s' of node %s: %s",
|
||||
local, node_name(n), gai_strerror(ret));
|
||||
|
@ -326,9 +326,9 @@ int ib_parse(struct node *n, json_t *cfg)
|
|||
if (ib->is_source) {
|
||||
/* Translate address info */
|
||||
char *ip_adr = strtok_r(remote, ":", &lasts);
|
||||
char *port = strtok_r(NULL, ":", &lasts);
|
||||
char *port = strtok_r(nullptr, ":", &lasts);
|
||||
|
||||
ret = getaddrinfo(ip_adr, port, NULL, &ib->conn.dst_addr);
|
||||
ret = getaddrinfo(ip_adr, port, nullptr, &ib->conn.dst_addr);
|
||||
if (ret)
|
||||
error("Failed to resolve remote address '%s' of node %s: %s",
|
||||
remote, node_name(n), gai_strerror(ret));
|
||||
|
@ -437,9 +437,9 @@ static void ib_create_bind_id(struct node *n)
|
|||
*
|
||||
*/
|
||||
#ifdef RDMA_CMA_H_CUSTOM
|
||||
ret = rdma_create_id2(ib->ctx.ec, &ib->ctx.id, NULL, ib->conn.port_space, ib->qp_init.qp_type);
|
||||
ret = rdma_create_id2(ib->ctx.ec, &ib->ctx.id, nullptr, ib->conn.port_space, ib->qp_init.qp_type);
|
||||
#else
|
||||
ret = rdma_create_id(ib->ctx.ec, &ib->ctx.id, NULL, ib->conn.port_space);
|
||||
ret = rdma_create_id(ib->ctx.ec, &ib->ctx.id, nullptr, ib->conn.port_space);
|
||||
#endif
|
||||
if (ret)
|
||||
error("Failed to create rdma_cm_id of node %s: %s", node_name(n), gai_strerror(ret));
|
||||
|
@ -604,7 +604,7 @@ void * ib_rdma_cm_event_thread(void *n)
|
|||
break;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int ib_start(struct node *n)
|
||||
|
@ -629,7 +629,7 @@ int ib_start(struct node *n)
|
|||
/* Resolve address or listen to rdma_cm_id */
|
||||
if (ib->is_source) {
|
||||
/* Resolve address */
|
||||
ret = rdma_resolve_addr(ib->ctx.id, NULL, ib->conn.dst_addr->ai_addr, ib->conn.timeout);
|
||||
ret = rdma_resolve_addr(ib->ctx.id, nullptr, ib->conn.dst_addr->ai_addr, ib->conn.timeout);
|
||||
if (ret)
|
||||
error("Failed to resolve remote address after %ims of node %s: %s",
|
||||
ib->conn.timeout, node_name(n), gai_strerror(ret));
|
||||
|
@ -662,7 +662,7 @@ int ib_start(struct node *n)
|
|||
debug(LOG_IB | 1, "Starting to monitor events on rdma_cm_id");
|
||||
|
||||
/* Create thread to monitor rdma_cm_event channel */
|
||||
ret = pthread_create(&ib->conn.rdma_cm_event_thread, NULL, ib_rdma_cm_event_thread, n);
|
||||
ret = pthread_create(&ib->conn.rdma_cm_event_thread, nullptr, ib_rdma_cm_event_thread, n);
|
||||
if (ret)
|
||||
error("Failed to create thread to monitor rdma_cm events in node %s: %s",
|
||||
node_name(n), gai_strerror(ret));
|
||||
|
@ -701,7 +701,7 @@ int ib_stop(struct node *n)
|
|||
info("Disconnecting... Waiting for threads to join.");
|
||||
|
||||
/* Wait for event thread to join */
|
||||
ret = pthread_join(ib->conn.rdma_cm_event_thread, NULL);
|
||||
ret = pthread_join(ib->conn.rdma_cm_event_thread, nullptr);
|
||||
if (ret)
|
||||
error("Error while joining rdma_cm_event_thread in node %s: %i", node_name(n), ret);
|
||||
|
||||
|
@ -728,7 +728,7 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea
|
|||
{
|
||||
struct infiniband *ib = (struct infiniband *) n->_vd;
|
||||
struct ibv_wc wc[cnt];
|
||||
struct ibv_recv_wr wr[cnt], *bad_wr = NULL;
|
||||
struct ibv_recv_wr wr[cnt], *bad_wr = nullptr;
|
||||
struct ibv_sge sge[cnt][ib->qp_init.cap.max_recv_sge];
|
||||
struct ibv_mr *mr;
|
||||
struct timespec ts_receive;
|
||||
|
@ -821,7 +821,7 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea
|
|||
wr[i].num_sge = j;
|
||||
}
|
||||
|
||||
wr[max_wr_post-1].next = NULL;
|
||||
wr[max_wr_post-1].next = nullptr;
|
||||
|
||||
debug(LOG_IB | 5, "Prepared %i new receive Work Requests", max_wr_post);
|
||||
debug(LOG_IB | 5, "%i receive Work Requests in Receive Queue", ib->conn.available_recv_wrs);
|
||||
|
@ -868,7 +868,7 @@ int ib_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *relea
|
|||
int ib_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release)
|
||||
{
|
||||
struct infiniband *ib = (struct infiniband *) n->_vd;
|
||||
struct ibv_send_wr wr[cnt], *bad_wr = NULL;
|
||||
struct ibv_send_wr wr[cnt], *bad_wr = nullptr;
|
||||
struct ibv_sge sge[cnt][ib->qp_init.cap.max_recv_sge];
|
||||
struct ibv_wc wc[cnt];
|
||||
struct ibv_mr *mr;
|
||||
|
@ -942,7 +942,7 @@ int ib_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rele
|
|||
}
|
||||
|
||||
debug(LOG_IB | 10, "Prepared %i send Work Requests", cnt);
|
||||
wr[cnt-1].next = NULL;
|
||||
wr[cnt-1].next = nullptr;
|
||||
|
||||
/* Send linked list of Work Requests */
|
||||
ret = ibv_post_send(ib->ctx.id->qp, wr, &bad_wr);
|
||||
|
|
|
@ -53,7 +53,7 @@ int influxdb_parse(struct node *n, json_t *json)
|
|||
tmp = strdup(server);
|
||||
|
||||
host = strtok_r(tmp, ":", &lasts);
|
||||
port = strtok_r(NULL, "", &lasts);
|
||||
port = strtok_r(nullptr, "", &lasts);
|
||||
|
||||
i->key = strdup(key);
|
||||
i->host = strdup(host);
|
||||
|
@ -80,7 +80,7 @@ int influxdb_open(struct node *n)
|
|||
error("Failed to lookup server: %s", gai_strerror(ret));
|
||||
|
||||
/* Loop through all the results and connect to the first we can */
|
||||
for (p = servinfo; p != NULL; p = p->ai_next) {
|
||||
for (p = servinfo; p != nullptr; p = p->ai_next) {
|
||||
i->sd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
|
||||
if (i->sd == -1) {
|
||||
serror("socket");
|
||||
|
@ -121,7 +121,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned
|
|||
{
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
ssize_t sentlen, buflen;
|
||||
|
||||
for (unsigned k = 0; k < cnt; k++) {
|
||||
|
@ -191,7 +191,7 @@ int influxdb_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned
|
|||
char * influxdb_print(struct node *n)
|
||||
{
|
||||
struct influxdb *i = (struct influxdb *) n->_vd;
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "host=%s, port=%s, key=%s", i->host, i->port, i->key);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
int loopback_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
const char *mode_str = NULL;
|
||||
const char *mode_str = nullptr;
|
||||
|
||||
json_error_t err;
|
||||
int ret;
|
||||
|
@ -134,7 +134,7 @@ int loopback_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned
|
|||
char * loopback_print(struct node *n)
|
||||
{
|
||||
struct loopback *l = (struct loopback *) n->_vd;
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "queuelen=%d", l->queuelen);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ static void mqtt_connect_cb(struct mosquitto *mosq, void *userdata, int result)
|
|||
info("MQTT: Node %s connected to broker %s", node_name(n), m->host);
|
||||
|
||||
if (m->subscribe) {
|
||||
ret = mosquitto_subscribe(m->client, NULL, m->subscribe, m->qos);
|
||||
ret = mosquitto_subscribe(m->client, nullptr, m->subscribe, m->qos);
|
||||
if (ret)
|
||||
warning("MQTT: failed to subscribe to topic '%s' for node %s: %s", m->subscribe, node_name(n), mosquitto_strerror(ret));
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ static void mqtt_message_cb(struct mosquitto *mosq, void *userdata, const struct
|
|||
return;
|
||||
}
|
||||
|
||||
ret = io_sscan(&m->io, (char *) msg->payload, msg->payloadlen, NULL, smps, n->in.vectorize);
|
||||
ret = io_sscan(&m->io, (char *) msg->payload, msg->payloadlen, nullptr, smps, n->in.vectorize);
|
||||
if (ret < 0) {
|
||||
warning("MQTT: Node %s received an invalid message", node_name(n));
|
||||
warning(" Payload: %s", (char *) msg->payload);
|
||||
|
@ -131,10 +131,10 @@ int mqtt_parse(struct node *n, json_t *cfg)
|
|||
|
||||
const char *host;
|
||||
const char *format = "villas.binary";
|
||||
const char *publish = NULL;
|
||||
const char *subscribe = NULL;
|
||||
const char *username = NULL;
|
||||
const char *password = NULL;
|
||||
const char *publish = nullptr;
|
||||
const char *subscribe = nullptr;
|
||||
const char *username = nullptr;
|
||||
const char *password = nullptr;
|
||||
|
||||
/* Default values */
|
||||
m->port = 1883;
|
||||
|
@ -145,7 +145,7 @@ int mqtt_parse(struct node *n, json_t *cfg)
|
|||
m->ssl.insecure = 0;
|
||||
|
||||
json_error_t err;
|
||||
json_t *json_ssl = NULL;
|
||||
json_t *json_ssl = nullptr;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s?: { s?: s }, s?: { s?: s }, s?: s, s: s, s?: i, s?: i, s?: i, s?: b, s?: s, s?: s, s?: o }",
|
||||
"out",
|
||||
|
@ -166,19 +166,19 @@ int mqtt_parse(struct node *n, json_t *cfg)
|
|||
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
|
||||
|
||||
m->host = strdup(host);
|
||||
m->publish = publish ? strdup(publish) : NULL;
|
||||
m->subscribe = subscribe ? strdup(subscribe) : NULL;
|
||||
m->username = username ? strdup(username) : NULL;
|
||||
m->password = password ? strdup(password) : NULL;
|
||||
m->publish = publish ? strdup(publish) : nullptr;
|
||||
m->subscribe = subscribe ? strdup(subscribe) : nullptr;
|
||||
m->username = username ? strdup(username) : nullptr;
|
||||
m->password = password ? strdup(password) : nullptr;
|
||||
|
||||
if (!m->publish && !m->subscribe)
|
||||
error("At least one topic has to be specified for node %s", node_name(n));
|
||||
|
||||
if (json_ssl) {
|
||||
const char *cafile = NULL;
|
||||
const char *capath = NULL;
|
||||
const char *certfile = NULL;
|
||||
const char *keyfile = NULL;
|
||||
const char *cafile = nullptr;
|
||||
const char *capath = nullptr;
|
||||
const char *certfile = nullptr;
|
||||
const char *keyfile = nullptr;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s?: b, s?: b, s?: s, s?: s, s?: s, s?: s }",
|
||||
"enabled", &m->ssl.enabled,
|
||||
|
@ -194,10 +194,10 @@ int mqtt_parse(struct node *n, json_t *cfg)
|
|||
if (m->ssl.enabled && !cafile && !capath)
|
||||
error("Either 'ssl.cafile' or 'ssl.capath' settings must be set for node %s.", node_name(n));
|
||||
|
||||
m->ssl.cafile = cafile ? strdup(cafile) : NULL;
|
||||
m->ssl.capath = capath ? strdup(capath) : NULL;
|
||||
m->ssl.certfile = certfile ? strdup(certfile) : NULL;
|
||||
m->ssl.keyfile = keyfile ? strdup(keyfile) : NULL;
|
||||
m->ssl.cafile = cafile ? strdup(cafile) : nullptr;
|
||||
m->ssl.capath = capath ? strdup(capath) : nullptr;
|
||||
m->ssl.certfile = certfile ? strdup(certfile) : nullptr;
|
||||
m->ssl.keyfile = keyfile ? strdup(keyfile) : nullptr;
|
||||
}
|
||||
|
||||
m->format = format_type_lookup(format);
|
||||
|
@ -227,7 +227,7 @@ char * mqtt_print(struct node *n)
|
|||
{
|
||||
struct mqtt *m = (struct mqtt *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "format=%s, host=%s, port=%d, keepalive=%s, ssl=%s", format_type_name(m->format),
|
||||
m->host,
|
||||
|
@ -294,7 +294,7 @@ int mqtt_start(struct node *n)
|
|||
}
|
||||
|
||||
if (m->ssl.enabled) {
|
||||
ret = mosquitto_tls_set(m->client, m->ssl.cafile, m->ssl.capath, m->ssl.certfile, m->ssl.keyfile, NULL);
|
||||
ret = mosquitto_tls_set(m->client, m->ssl.cafile, m->ssl.capath, m->ssl.certfile, m->ssl.keyfile, nullptr);
|
||||
if (ret)
|
||||
goto mosquitto_error;
|
||||
|
||||
|
@ -426,7 +426,7 @@ int mqtt_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *re
|
|||
return ret;
|
||||
|
||||
if (m->publish) {
|
||||
ret = mosquitto_publish(m->client, NULL /* mid */, m->publish, wbytes, data, m->qos, m->retain);
|
||||
ret = mosquitto_publish(m->client, nullptr /* mid */, m->publish, wbytes, data, m->qos, m->retain);
|
||||
if (ret != MOSQ_ERR_SUCCESS) {
|
||||
warning("MQTT: publish failed for node %s: %s", node_name(n), mosquitto_strerror(ret));
|
||||
return -abs(ret);
|
||||
|
|
|
@ -86,8 +86,8 @@ int nanomsg_parse(struct node *n, json_t *cfg)
|
|||
|
||||
json_error_t err;
|
||||
|
||||
json_t *json_out_endpoints = NULL;
|
||||
json_t *json_in_endpoints = NULL;
|
||||
json_t *json_out_endpoints = nullptr;
|
||||
json_t *json_in_endpoints = nullptr;
|
||||
|
||||
vlist_init(&m->out.endpoints);
|
||||
vlist_init(&m->in.endpoints);
|
||||
|
@ -125,7 +125,7 @@ char * nanomsg_print(struct node *n)
|
|||
{
|
||||
struct nanomsg *m = (struct nanomsg *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "format=%s, in.endpoints=[ ", format_type_name(m->format));
|
||||
|
||||
|
@ -241,7 +241,7 @@ int nanomsg_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *
|
|||
if (bytes < 0)
|
||||
return -1;
|
||||
|
||||
return io_sscan(&m->io, data, bytes, NULL, smps, cnt);
|
||||
return io_sscan(&m->io, data, bytes, nullptr, smps, cnt);
|
||||
}
|
||||
|
||||
int nanomsg_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *release)
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <villas/node/config.h>
|
||||
|
||||
/* Some global settings */
|
||||
static char *name = NULL;
|
||||
static char *name = nullptr;
|
||||
|
||||
enum ngsi_flags {
|
||||
NGSI_ENTITY_ATTRIBUTES = (1 << 0),
|
||||
|
@ -290,8 +290,8 @@ static size_t ngsi_request_writer(void *contents, size_t size, size_t nmemb, voi
|
|||
struct ngsi_response *mem = (struct ngsi_response *) userp;
|
||||
|
||||
mem->data = (char *) realloc(mem->data, mem->len + realsize + 1);
|
||||
if (mem->data == NULL) /* out of memory! */
|
||||
error("Not enough memory (realloc returned NULL)");
|
||||
if (mem->data == nullptr) /* out of memory! */
|
||||
error("Not enough memory (realloc returned nullptr)");
|
||||
|
||||
memcpy(&(mem->data[mem->len]), contents, realsize);
|
||||
mem->len += realsize;
|
||||
|
@ -322,7 +322,7 @@ static int ngsi_request(CURL *handle, const char *endpoint, const char *operatio
|
|||
/* We don't want to leave the handle in an invalid state */
|
||||
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &old);
|
||||
CURLcode ret = curl_easy_perform(handle);
|
||||
pthread_setcancelstate(old, NULL);
|
||||
pthread_setcancelstate(old, nullptr);
|
||||
|
||||
if (ret) {
|
||||
warning("HTTP request failed: %s", curl_easy_strerror(ret));
|
||||
|
@ -416,7 +416,7 @@ int ngsi_parse(struct node *n, json_t *cfg)
|
|||
json_t *json_mapping;
|
||||
|
||||
/* Default values */
|
||||
i->access_token = NULL; /* disabled by default */
|
||||
i->access_token = nullptr; /* disabled by default */
|
||||
i->ssl_verify = 1; /* verify by default */
|
||||
i->timeout = 1; /* default value */
|
||||
i->rate = 5; /* default value */
|
||||
|
@ -483,7 +483,7 @@ int ngsi_start(struct node *n)
|
|||
int ret;
|
||||
|
||||
i->curl = curl_easy_init();
|
||||
i->headers = NULL;
|
||||
i->headers = nullptr;
|
||||
|
||||
if (i->access_token) {
|
||||
char buf[128];
|
||||
|
@ -508,7 +508,7 @@ int ngsi_start(struct node *n)
|
|||
curl_easy_setopt(i->curl, CURLOPT_USERAGENT, USER_AGENT);
|
||||
|
||||
/* Create entity and atributes */
|
||||
json_t *entity = ngsi_build_entity(i, NULL, 0, NGSI_ENTITY_METADATA);
|
||||
json_t *entity = ngsi_build_entity(i, nullptr, 0, NGSI_ENTITY_METADATA);
|
||||
|
||||
ret = ngsi_request_context_update(i->curl, i->endpoint, "APPEND", entity);
|
||||
if (ret)
|
||||
|
@ -525,7 +525,7 @@ int ngsi_stop(struct node *n)
|
|||
int ret;
|
||||
|
||||
/* Delete complete entity (not just attributes) */
|
||||
json_t *entity = ngsi_build_entity(i, NULL, 0, 0);
|
||||
json_t *entity = ngsi_build_entity(i, nullptr, 0, 0);
|
||||
|
||||
ret = ngsi_request_context_update(i->curl, i->endpoint, "DELETE", entity);
|
||||
|
||||
|
@ -546,7 +546,7 @@ int ngsi_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *rel
|
|||
perror("Failed to wait for task");
|
||||
|
||||
json_t *rentity;
|
||||
json_t *entity = ngsi_build_entity(i, NULL, 0, 0);
|
||||
json_t *entity = ngsi_build_entity(i, nullptr, 0, 0);
|
||||
|
||||
ret = ngsi_request_context_query(i->curl, i->endpoint, entity, &rentity);
|
||||
if (ret)
|
||||
|
|
|
@ -56,7 +56,7 @@ int opal_type_start(struct super_node *sn)
|
|||
if (sn->cli.argc != 4)
|
||||
return -1; */
|
||||
|
||||
pthread_mutex_init(&lock, NULL);
|
||||
pthread_mutex_init(&lock, nullptr);
|
||||
|
||||
/* Enable the OpalPrint function. This prints to the OpalDisplay. */
|
||||
err = OpalSystemCtrl_Register(print_shmem_name);
|
||||
|
|
|
@ -39,10 +39,10 @@
|
|||
int shmem_parse(struct node *n, json_t *cfg)
|
||||
{
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
const char *val, *mode_str = NULL;
|
||||
const char *val, *mode_str = nullptr;
|
||||
|
||||
int ret;
|
||||
json_t *json_exec = NULL;
|
||||
json_t *json_exec = nullptr;
|
||||
json_error_t err;
|
||||
|
||||
int len = MAX(vlist_length(&n->in.signals), vlist_length(&n->out.signals));
|
||||
|
@ -51,7 +51,7 @@ int shmem_parse(struct node *n, json_t *cfg)
|
|||
shm->conf.queuelen = MAX(DEFAULT_SHMEM_QUEUELEN, n->in.vectorize);
|
||||
shm->conf.samplelen = len;
|
||||
shm->conf.polling = false;
|
||||
shm->exec = NULL;
|
||||
shm->exec = nullptr;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{ s: { s: s }, s: { s: s }, s?: i, s?: o, s?: s }",
|
||||
"out",
|
||||
|
@ -90,7 +90,7 @@ int shmem_parse(struct node *n, json_t *cfg)
|
|||
shm->exec[i] = strdup(val);
|
||||
}
|
||||
|
||||
shm->exec[i] = NULL;
|
||||
shm->exec[i] = nullptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -178,7 +178,7 @@ int shmem_write(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r
|
|||
char * shmem_print(struct node *n)
|
||||
{
|
||||
struct shmem *shm = (struct shmem *) n->_vd;
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
strcatf(&buf, "out_name=%s, in_name=%s, queuelen=%d, polling=%s",
|
||||
shm->out_name, shm->in_name, shm->conf.queuelen, shm->conf.polling ? "yes" : "no");
|
||||
|
|
|
@ -78,7 +78,7 @@ static const char * signal_generator_type_str(enum signal_generator::type type)
|
|||
return "mixed";
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ int signal_generator_parse(struct node *n, json_t *cfg)
|
|||
struct signal_generator *s = (struct signal_generator *) n->_vd;
|
||||
|
||||
int ret;
|
||||
const char *type = NULL;
|
||||
const char *type = nullptr;
|
||||
|
||||
json_error_t err;
|
||||
|
||||
|
@ -279,7 +279,7 @@ int signal_generator_read(struct node *n, struct sample *smps[], unsigned cnt, u
|
|||
char * signal_generator_print(struct node *n)
|
||||
{
|
||||
struct signal_generator *s = (struct signal_generator *) n->_vd;
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
const char *type = signal_generator_type_str(s->type);
|
||||
|
||||
strcatf(&buf, "signal=%s, rt=%s, rate=%.2f, values=%d, frequency=%.2f, amplitude=%.2f, stddev=%.2f, offset=%.2f",
|
||||
|
|
|
@ -73,7 +73,7 @@ int socket_type_start(struct super_node *sn)
|
|||
char * socket_print(struct node *n)
|
||||
{
|
||||
struct socket *s = (struct socket *) n->_vd;
|
||||
const char *layer = NULL;
|
||||
const char *layer = nullptr;
|
||||
char *buf;
|
||||
|
||||
switch (s->layer) {
|
||||
|
@ -453,12 +453,12 @@ int socket_parse(struct node *n, json_t *cfg)
|
|||
struct socket *s = (struct socket *) n->_vd;
|
||||
|
||||
const char *local, *remote;
|
||||
const char *layer = NULL;
|
||||
const char *layer = nullptr;
|
||||
const char *format = "villas.binary";
|
||||
|
||||
int ret;
|
||||
|
||||
json_t *json_multicast = NULL;
|
||||
json_t *json_multicast = nullptr;
|
||||
json_error_t err;
|
||||
|
||||
/* Default values */
|
||||
|
@ -512,7 +512,7 @@ int socket_parse(struct node *n, json_t *cfg)
|
|||
}
|
||||
|
||||
if (json_multicast) {
|
||||
const char *group, *interface = NULL;
|
||||
const char *group, *interface = nullptr;
|
||||
|
||||
/* Default values */
|
||||
s->multicast.enabled = true;
|
||||
|
|
|
@ -129,7 +129,7 @@ static const char * uldaq_print_interface_type(DaqDeviceInterface iftype)
|
|||
return interface_types[i].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static Range uldaq_parse_range(const char *str)
|
||||
|
@ -143,12 +143,12 @@ static Range uldaq_parse_range(const char *str)
|
|||
}
|
||||
|
||||
static DaqDeviceDescriptor * uldaq_find_device(struct uldaq *u) {
|
||||
DaqDeviceDescriptor *d = NULL;
|
||||
DaqDeviceDescriptor *d = nullptr;
|
||||
|
||||
if (num_devs == 0)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (u->device_interface_type == ANY_IFC && u->device_id == NULL)
|
||||
if (u->device_interface_type == ANY_IFC && u->device_id == nullptr)
|
||||
return &descriptors[0];
|
||||
|
||||
for (unsigned i = 0; i < num_devs; i++) {
|
||||
|
@ -167,7 +167,7 @@ static DaqDeviceDescriptor * uldaq_find_device(struct uldaq *u) {
|
|||
return d;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int uldaq_connect(struct node *n)
|
||||
|
@ -237,19 +237,19 @@ int uldaq_init(struct node *n)
|
|||
int ret;
|
||||
struct uldaq *u = (struct uldaq *) n->_vd;
|
||||
|
||||
u->device_id = NULL;
|
||||
u->device_id = nullptr;
|
||||
u->device_interface_type = ANY_IFC;
|
||||
|
||||
u->in.queues = NULL;
|
||||
u->in.queues = nullptr;
|
||||
u->in.sample_rate = 1000;
|
||||
u->in.scan_options = (ScanOption) (SO_DEFAULTIO | SO_CONTINUOUS);
|
||||
u->in.flags = AINSCAN_FF_DEFAULT;
|
||||
|
||||
ret = pthread_mutex_init(&u->in.mutex, NULL);
|
||||
ret = pthread_mutex_init(&u->in.mutex, nullptr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = pthread_cond_init(&u->in.cv, NULL);
|
||||
ret = pthread_cond_init(&u->in.cv, nullptr);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -280,9 +280,9 @@ int uldaq_parse(struct node *n, json_t *cfg)
|
|||
int ret;
|
||||
struct uldaq *u = (struct uldaq *) n->_vd;
|
||||
|
||||
const char *default_range_str = NULL;
|
||||
const char *default_input_mode_str = NULL;
|
||||
const char *interface_type = NULL;
|
||||
const char *default_range_str = nullptr;
|
||||
const char *default_input_mode_str = nullptr;
|
||||
const char *interface_type = nullptr;
|
||||
|
||||
size_t i;
|
||||
json_t *json_signals;
|
||||
|
@ -313,7 +313,7 @@ int uldaq_parse(struct node *n, json_t *cfg)
|
|||
u->in.queues = (struct AiQueueElement *) realloc(u->in.queues, sizeof(struct AiQueueElement) * u->in.channel_count);
|
||||
|
||||
json_array_foreach(json_signals, i, json_signal) {
|
||||
const char *range_str = NULL, *input_mode_str = NULL;
|
||||
const char *range_str = nullptr, *input_mode_str = nullptr;
|
||||
int channel = -1, input_mode, range;
|
||||
|
||||
ret = json_unpack_ex(json_signal, &err, 0, "{ s?: s, s?: s, s?: i }",
|
||||
|
@ -359,7 +359,7 @@ char * uldaq_print(struct node *n)
|
|||
{
|
||||
struct uldaq *u = (struct uldaq *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
if (u->device_descriptor) {
|
||||
char *uid = u->device_descriptor->uniqueId;
|
||||
|
|
|
@ -58,7 +58,7 @@ static char * websocket_connection_name(struct websocket_connection *c)
|
|||
|
||||
strcatf(&c->_name, "remote.ip=%s, remote.name=%s", ip, name);
|
||||
}
|
||||
else if (c->mode == websocket_connection::mode::CLIENT && c->destination != NULL)
|
||||
else if (c->mode == websocket_connection::mode::CLIENT && c->destination != nullptr)
|
||||
strcatf(&c->_name, "dest=%s:%d", c->destination->info.address, c->destination->info.port);
|
||||
|
||||
if (c->node)
|
||||
|
@ -82,7 +82,7 @@ static int websocket_connection_init(struct websocket_connection *c)
|
|||
{
|
||||
int ret;
|
||||
|
||||
c->_name = NULL;
|
||||
c->_name = nullptr;
|
||||
|
||||
ret = queue_init(&c->queue, DEFAULT_QUEUE_LENGTH, &memory_hugepage);
|
||||
if (ret)
|
||||
|
@ -140,8 +140,8 @@ static int websocket_connection_destroy(struct websocket_connection *c)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
c->wsi = NULL;
|
||||
c->_name = NULL;
|
||||
c->wsi = nullptr;
|
||||
c->_name = nullptr;
|
||||
|
||||
c->state = websocket_connection::state::DESTROYED;
|
||||
|
||||
|
@ -220,7 +220,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|||
return -1;
|
||||
}
|
||||
|
||||
format = strtok_r(NULL, "", &lasts);
|
||||
format = strtok_r(nullptr, "", &lasts);
|
||||
if (!format)
|
||||
format = (char *) "villas.web";
|
||||
|
||||
|
@ -334,7 +334,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
|
|||
if (avail < cnt)
|
||||
warning("Pool underrun for connection: %s", websocket_connection_name(c));
|
||||
|
||||
recvd = io_sscan(&c->io, c->buffers.recv.buf, c->buffers.recv.len, NULL, smps, avail);
|
||||
recvd = io_sscan(&c->io, c->buffers.recv.buf, c->buffers.recv.len, nullptr, smps, avail);
|
||||
if (recvd < 0) {
|
||||
warning("Failed to parse sample data received on connection: %s", websocket_connection_name(c));
|
||||
break;
|
||||
|
@ -532,7 +532,7 @@ int websocket_parse(struct node *n, json_t *cfg)
|
|||
int ret;
|
||||
|
||||
size_t i;
|
||||
json_t *json_dests = NULL;
|
||||
json_t *json_dests = nullptr;
|
||||
json_t *json_dest;
|
||||
json_error_t err;
|
||||
|
||||
|
@ -580,7 +580,7 @@ char * websocket_print(struct node *n)
|
|||
{
|
||||
struct websocket *w = (struct websocket *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
char *buf = nullptr;
|
||||
|
||||
buf = strcatf(&buf, "destinations=[ ");
|
||||
|
||||
|
|
|
@ -96,15 +96,15 @@ int zeromq_parse(struct node *n, json_t *cfg)
|
|||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
int ret;
|
||||
const char *ep = NULL;
|
||||
const char *type = NULL;
|
||||
const char *in_filter = NULL;
|
||||
const char *out_filter = NULL;
|
||||
const char *ep = nullptr;
|
||||
const char *type = nullptr;
|
||||
const char *in_filter = nullptr;
|
||||
const char *out_filter = nullptr;
|
||||
const char *format = "villas.binary";
|
||||
|
||||
size_t i;
|
||||
json_t *json_pub = NULL;
|
||||
json_t *json_curve = NULL;
|
||||
json_t *json_pub = nullptr;
|
||||
json_t *json_curve = nullptr;
|
||||
json_t *json_val;
|
||||
json_error_t err;
|
||||
|
||||
|
@ -128,9 +128,9 @@ int zeromq_parse(struct node *n, json_t *cfg)
|
|||
if (ret)
|
||||
jerror(&err, "Failed to parse configuration of node %s", node_name(n));
|
||||
|
||||
z->in.endpoint = ep ? strdup(ep) : NULL;
|
||||
z->in.filter = in_filter ? strdup(in_filter) : NULL;
|
||||
z->out.filter = out_filter ? strdup(out_filter) : NULL;
|
||||
z->in.endpoint = ep ? strdup(ep) : nullptr;
|
||||
z->in.filter = in_filter ? strdup(in_filter) : nullptr;
|
||||
z->out.filter = out_filter ? strdup(out_filter) : nullptr;
|
||||
|
||||
z->format = format_type_lookup(format);
|
||||
if (!z->format)
|
||||
|
@ -205,8 +205,8 @@ char * zeromq_print(struct node *n)
|
|||
{
|
||||
struct zeromq *z = (struct zeromq *) n->_vd;
|
||||
|
||||
char *buf = NULL;
|
||||
const char *pattern = NULL;
|
||||
char *buf = nullptr;
|
||||
const char *pattern = nullptr;
|
||||
|
||||
switch (z->pattern) {
|
||||
case zeromq::pattern::PUBSUB:
|
||||
|
@ -249,7 +249,7 @@ int zeromq_type_start(struct super_node *sn)
|
|||
{
|
||||
context = zmq_ctx_new();
|
||||
|
||||
return context == NULL;
|
||||
return context == nullptr;
|
||||
}
|
||||
|
||||
int zeromq_type_stop()
|
||||
|
@ -389,7 +389,7 @@ int zeromq_start(struct node *n)
|
|||
|
||||
#if defined(ZMQ_BUILD_DRAFT_API) && ZMQ_MAJOR_VERSION >= 4 && ZMQ_MINOR_VERSION >= 2 && ZMQ_MINOR_VERSION >= 3
|
||||
if (z->curve.enabled) {
|
||||
ret = get_monitor_event(z->in.mon_socket, NULL, NULL);
|
||||
ret = get_monitor_event(z->in.mon_socket, nullptr, nullptr);
|
||||
return ret == ZMQ_EVENT_HANDSHAKE_SUCCEEDED;
|
||||
}
|
||||
else
|
||||
|
@ -437,7 +437,7 @@ int zeromq_destroy(struct node *n)
|
|||
if (z->out.filter)
|
||||
free(z->out.filter);
|
||||
|
||||
ret = vlist_destroy(&z->out.endpoints, NULL, true);
|
||||
ret = vlist_destroy(&z->out.endpoints, nullptr, true);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -459,7 +459,7 @@ int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r
|
|||
switch (z->pattern) {
|
||||
case zeromq::pattern::PUBSUB:
|
||||
/* Discard envelope */
|
||||
zmq_recv(z->in.socket, NULL, 0, 0);
|
||||
zmq_recv(z->in.socket, nullptr, 0, 0);
|
||||
break;
|
||||
|
||||
default: { }
|
||||
|
@ -471,7 +471,7 @@ int zeromq_read(struct node *n, struct sample *smps[], unsigned cnt, unsigned *r
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
recv = io_sscan(&z->io, (const char *) zmq_msg_data(&m), zmq_msg_size(&m), NULL, smps, cnt);
|
||||
recv = io_sscan(&z->io, (const char *) zmq_msg_data(&m), zmq_msg_size(&m), nullptr, smps, cnt);
|
||||
|
||||
ret = zmq_msg_close(&m);
|
||||
if (ret)
|
||||
|
|
Loading…
Add table
Reference in a new issue