mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
refactor: NULL -> nullptr
This commit is contained in:
parent
677f8b2aa2
commit
7f4e69ea4b
12 changed files with 53 additions and 54 deletions
|
@ -192,15 +192,15 @@ int SuperNode::parseUri(const char *u)
|
|||
int SuperNode::parseJson(json_t *j)
|
||||
{
|
||||
int ret;
|
||||
const char *nme = NULL;
|
||||
const char *nme = nullptr;
|
||||
|
||||
assert(state != STATE_STARTED);
|
||||
|
||||
json_t *json_nodes = NULL;
|
||||
json_t *json_paths = NULL;
|
||||
json_t *json_plugins = NULL;
|
||||
json_t *json_logging = NULL;
|
||||
json_t *json_web = NULL;
|
||||
json_t *json_nodes = nullptr;
|
||||
json_t *json_paths = nullptr;
|
||||
json_t *json_plugins = nullptr;
|
||||
json_t *json_logging = nullptr;
|
||||
json_t *json_web = nullptr;
|
||||
|
||||
json_error_t err;
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ check: if (optarg == endptr)
|
|||
if (ret)
|
||||
error("Failed to validate IO configuration");
|
||||
|
||||
ret = io_open(dirs[i].io, NULL);
|
||||
ret = io_open(dirs[i].io, nullptr);
|
||||
if (ret)
|
||||
error("Failed to open IO");
|
||||
}
|
||||
|
|
|
@ -209,7 +209,7 @@ check: if (optarg == endptr)
|
|||
if (ret)
|
||||
error("Failed to validate IO configuration");
|
||||
|
||||
ret = io_open(&io, NULL);
|
||||
ret = io_open(&io, nullptr);
|
||||
if (ret)
|
||||
error("Failed to open IO");
|
||||
|
||||
|
@ -218,7 +218,7 @@ check: if (optarg == endptr)
|
|||
if (!ht)
|
||||
error("Unknown hook function '%s'", hook);
|
||||
|
||||
ret = hook_init(&h, ht, NULL, NULL);
|
||||
ret = hook_init(&h, ht, nullptr, nullptr);
|
||||
if (ret)
|
||||
error("Failed to initialize hook");
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
|
|||
continue;
|
||||
}
|
||||
|
||||
char *uri = argc == optind + 1 ? argv[optind] : NULL;
|
||||
char *uri = argc == optind + 1 ? argv[optind] : nullptr;
|
||||
#endif /* ENABLE_OPAL_ASYNC */
|
||||
|
||||
info("This is VILLASnode %s (built on %s, %s)", CLR_BLD(CLR_YEL(PROJECT_BUILD_ID)),
|
||||
|
|
|
@ -191,7 +191,7 @@ leave: if (io_eof(&io)) {
|
|||
killme(SIGTERM);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void * recv_loop(void *ctx)
|
||||
|
@ -235,7 +235,7 @@ static void * recv_loop(void *ctx)
|
|||
leave: info("Reached receive limit. Terminating...");
|
||||
killme(SIGTERM);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
|
@ -334,7 +334,7 @@ check: if (optarg == endptr)
|
|||
if (ret)
|
||||
error("Failed to validate IO configuration");
|
||||
|
||||
ret = io_open(&io, NULL);
|
||||
ret = io_open(&io, nullptr);
|
||||
if (ret)
|
||||
error("Failed to open IO");
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ check: if (optarg == endptr)
|
|||
}
|
||||
|
||||
if (argc != optind + 1)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
type = argv[optind];
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ Test(utils, json_to_config)
|
|||
|
||||
cfg_root = config_root_setting(&cfg);
|
||||
|
||||
json = json_loads(json_example, 0, NULL);
|
||||
json = json_loads(json_example, 0, nullptr);
|
||||
cr_assert_not_null(json);
|
||||
|
||||
json_to_config(json, cfg_root);
|
||||
|
|
|
@ -37,37 +37,37 @@ ParameterizedTestParameters(json, json_load_cli)
|
|||
static struct param params[] = {
|
||||
// Combined long option
|
||||
{
|
||||
.argv = { "dummy", "--option=value", NULL },
|
||||
.argv = { "dummy", "--option=value", nullptr },
|
||||
.json = "{ \"option\" : \"value\" }"
|
||||
},
|
||||
// Separated long option
|
||||
{
|
||||
.argv = { "dummy", "--option", "value", NULL },
|
||||
.argv = { "dummy", "--option", "value", nullptr },
|
||||
.json = "{ \"option\" : \"value\" }"
|
||||
},
|
||||
// All kinds of data types
|
||||
{
|
||||
.argv = { "dummy", "--integer", "1", "--real", "1.1", "--bool", "true", "--null", "null", "--string", "hello world", NULL },
|
||||
.argv = { "dummy", "--integer", "1", "--real", "1.1", "--bool", "true", "--null", "null", "--string", "hello world", nullptr },
|
||||
.json = "{ \"integer\" : 1, \"real\" : 1.1, \"bool\" : true, \"null\" : null, \"string\" : \"hello world\" }"
|
||||
},
|
||||
// Array generation
|
||||
{
|
||||
.argv = { "dummy", "--bool", "true", "--bool", "false", NULL },
|
||||
.argv = { "dummy", "--bool", "true", "--bool", "false", nullptr },
|
||||
.json = "{ \"bool\" : [ true, false ] }"
|
||||
},
|
||||
// Dots in the option name generate sub objects
|
||||
{
|
||||
.argv = { "dummy", "--sub.option", "value", NULL },
|
||||
.argv = { "dummy", "--sub.option", "value", nullptr },
|
||||
.json = "{ \"sub\" : { \"option\" : \"value\" } }"
|
||||
},
|
||||
// Nesting is possible
|
||||
{
|
||||
.argv = { "dummy", "--sub.sub.option", "value", NULL },
|
||||
.argv = { "dummy", "--sub.sub.option", "value", nullptr },
|
||||
.json = "{ \"sub\" : { \"sub\" : { \"option\" : \"value\" } } }"
|
||||
},
|
||||
// Multiple subgroups are merged
|
||||
{
|
||||
.argv = { "dummy", "--sub.sub.option", "value1", "--sub.option", "value2", NULL },
|
||||
.argv = { "dummy", "--sub.sub.option", "value1", "--sub.option", "value2", nullptr },
|
||||
.json = "{ \"sub\" : { \"option\" : \"value2\", \"sub\" : { \"option\" : \"value1\" } } }"
|
||||
}
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ Test(mapping, parse_nodes)
|
|||
for (unsigned j = 0; j < ARRAY_LEN(signal_names[i]); j++) {
|
||||
struct signal *sig;
|
||||
|
||||
sig = signal_create(signal_names[i][j], NULL, SIGNAL_TYPE_AUTO);
|
||||
sig = signal_create(signal_names[i][j], nullptr, SIGNAL_TYPE_AUTO);
|
||||
cr_assert_not_null(sig);
|
||||
|
||||
list_push(&n->signals, sig);
|
||||
|
@ -104,7 +104,7 @@ Test(mapping, parse_nodes)
|
|||
cr_assert_eq(m.data.offset, 1);
|
||||
cr_assert_eq(m.length, 2);
|
||||
|
||||
ret = list_destroy(&nodes, NULL, true);
|
||||
ret = list_destroy(&nodes, nullptr, true);
|
||||
cr_assert_eq(ret, 0);
|
||||
}
|
||||
|
||||
|
@ -113,74 +113,74 @@ Test(mapping, parse)
|
|||
int ret;
|
||||
struct mapping_entry m;
|
||||
|
||||
ret = mapping_parse_str(&m, "ts.origin", NULL);
|
||||
ret = mapping_parse_str(&m, "ts.origin", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_TIMESTAMP);
|
||||
cr_assert_eq(m.timestamp.type, MAPPING_TIMESTAMP_TYPE_ORIGIN);
|
||||
|
||||
ret = mapping_parse_str(&m, "hdr.sequence", NULL);
|
||||
ret = mapping_parse_str(&m, "hdr.sequence", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_HEADER);
|
||||
cr_assert_eq(m.header.type, MAPPING_HEADER_TYPE_SEQUENCE);
|
||||
|
||||
ret = mapping_parse_str(&m, "stats.owd.mean", NULL);
|
||||
ret = mapping_parse_str(&m, "stats.owd.mean", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_STATS);
|
||||
cr_assert_eq(m.stats.id, STATS_OWD);
|
||||
cr_assert_eq(m.stats.type, MAPPING_STATS_TYPE_MEAN);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[1-2]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[1-2]", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_DATA);
|
||||
cr_assert_eq(m.data.offset, 1);
|
||||
cr_assert_eq(m.length, 2);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[5-5]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[5-5]", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_DATA);
|
||||
cr_assert_eq(m.data.offset, 5);
|
||||
cr_assert_eq(m.length, 1);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[22]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[22]", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_DATA);
|
||||
cr_assert_eq(m.data.offset, 22);
|
||||
cr_assert_eq(m.length, 1);
|
||||
|
||||
ret = mapping_parse_str(&m, "data", NULL);
|
||||
ret = mapping_parse_str(&m, "data", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_DATA);
|
||||
cr_assert_eq(m.data.offset, 0);
|
||||
cr_assert_eq(m.length, 0);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[]", nullptr);
|
||||
cr_assert_eq(ret, 0);
|
||||
cr_assert_eq(m.type, MAPPING_TYPE_DATA);
|
||||
cr_assert_eq(m.data.offset, 0);
|
||||
cr_assert_eq(m.length, 0);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[1.1-2f]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[1.1-2f]", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
/* Missing parts */
|
||||
ret = mapping_parse_str(&m, "stats.owd", NULL);
|
||||
ret = mapping_parse_str(&m, "stats.owd", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
/* This a type */
|
||||
ret = mapping_parse_str(&m, "hdr.sequences", NULL);
|
||||
ret = mapping_parse_str(&m, "hdr.sequences", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
/* Check for superfluous chars at the end */
|
||||
ret = mapping_parse_str(&m, "stats.ts.origin.bla", NULL);
|
||||
ret = mapping_parse_str(&m, "stats.ts.origin.bla", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
ret = mapping_parse_str(&m, "stats.ts.origin.", NULL);
|
||||
ret = mapping_parse_str(&m, "stats.ts.origin.", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
ret = mapping_parse_str(&m, "data[1-2]bla", NULL);
|
||||
ret = mapping_parse_str(&m, "data[1-2]bla", nullptr);
|
||||
cr_assert_neq(ret, 0);
|
||||
|
||||
/* Negative length of chunk */
|
||||
ret = mapping_parse_str(&m, "data[5-3]", NULL);
|
||||
ret = mapping_parse_str(&m, "data[5-3]", nullptr);
|
||||
cr_assert_eq(ret, -1);
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ ParameterizedTest(struct param *p, pool, basic, .init = init_memory)
|
|||
cr_assert_eq(ret, 0, "Failed to create pool");
|
||||
|
||||
ptr = pool_get(&pool);
|
||||
cr_assert_neq(ptr, NULL);
|
||||
cr_assert_neq(ptr, nullptr);
|
||||
|
||||
memset(ptr, 1, p->block_size); /* check that we dont get a seg fault */
|
||||
|
||||
|
@ -70,15 +70,15 @@ ParameterizedTest(struct param *p, pool, basic, .init = init_memory)
|
|||
for (i = 1; i < p->pool_size; i++) {
|
||||
ptrs[i] = pool_get(&pool);
|
||||
|
||||
if (ptrs[i] == NULL)
|
||||
if (ptrs[i] == nullptr)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i < p->pool_size)
|
||||
cr_assert_neq(ptrs[i], NULL);
|
||||
cr_assert_neq(ptrs[i], nullptr);
|
||||
|
||||
ptr = pool_get(&pool);
|
||||
cr_assert_eq(ptr, NULL);
|
||||
cr_assert_eq(ptr, nullptr);
|
||||
|
||||
ret = pool_destroy(&pool);
|
||||
cr_assert_eq(ret, 0, "Failed to destroy pool");
|
||||
|
|
|
@ -117,7 +117,7 @@ static void * producer(void *ctx)
|
|||
|
||||
//cr_log_info("producer: finished");
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void * consumer(void *ctx)
|
||||
|
@ -157,7 +157,7 @@ static void * consumer(void *ctx)
|
|||
|
||||
//cr_log_info("consumer: finished");
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined(_POSIX_BARRIERS) && _POSIX_BARRIERS > 0
|
||||
|
@ -319,14 +319,13 @@ ParameterizedTest(struct param *p, queue, multi_threaded, .timeout = 20, .init =
|
|||
|
||||
uint64_t start_tsc_time, end_tsc_time;
|
||||
|
||||
pthread_barrier_init(&barrier, NULL, p->thread_count);
|
||||
pthread_barrier_init(&barrier, nullptr, p->thread_count);
|
||||
|
||||
for (int i = 0; i < p->thread_count; ++i)
|
||||
pthread_create(&threads[i], NULL, p->many ? producer_consumer_many : producer_consumer, p);
|
||||
pthread_create(&threads[i], nullptr, p->many ? producer_consumer_many : producer_consumer, p);
|
||||
|
||||
sleep(0.2);
|
||||
|
||||
|
||||
ret = tsc_init(&tsc);
|
||||
cr_assert(!ret);
|
||||
|
||||
|
@ -334,7 +333,7 @@ ParameterizedTest(struct param *p, queue, multi_threaded, .timeout = 20, .init =
|
|||
p->start = 1;
|
||||
|
||||
for (int i = 0; i < p->thread_count; ++i)
|
||||
pthread_join(threads[i], NULL);
|
||||
pthread_join(threads[i], nullptr);
|
||||
|
||||
end_tsc_time = tsc_now(&tsc);
|
||||
cycpop = (end_tsc_time - start_tsc_time) / p->iter_count;
|
||||
|
|
|
@ -52,7 +52,7 @@ static void * producer(void * ctx)
|
|||
usleep(0.1e-3 * 1e6); /* 1 ms */
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static void * consumer(void * ctx)
|
||||
|
@ -73,7 +73,7 @@ static void * consumer(void * ctx)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void * polled_consumer(void *ctx)
|
||||
|
@ -106,7 +106,7 @@ again: ret = poll(&pfd, 1, -1);
|
|||
return (void *) 2; /* Indicates an error to the parent thread */
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ParameterizedTestParameters(queue_signalled, simple)
|
||||
|
@ -138,10 +138,10 @@ ParameterizedTest(struct param *param, queue_signalled, simple, .timeout = 5, .i
|
|||
ret = queue_signalled_init(&q, LOG2_CEIL(NUM_ELEM), &memory_heap, param->flags);
|
||||
cr_assert_eq(ret, 0, "Failed to initialize queue: flags=%#x, ret=%d", param->flags, ret);
|
||||
|
||||
ret = pthread_create(&t1, NULL, producer, &q);
|
||||
ret = pthread_create(&t1, nullptr, producer, &q);
|
||||
cr_assert_eq(ret, 0);
|
||||
|
||||
ret = pthread_create(&t2, NULL, param->polled ? polled_consumer : consumer, &q);
|
||||
ret = pthread_create(&t2, nullptr, param->polled ? polled_consumer : consumer, &q);
|
||||
cr_assert_eq(ret, 0);
|
||||
|
||||
ret = pthread_join(t1, &r1);
|
||||
|
|
Loading…
Add table
Reference in a new issue