diff --git a/common b/common index c423c60f5..39e23fc9a 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c423c60f502a189bb636ce1c669e15438ee89299 +Subproject commit 39e23fc9a7234e7a235efd49e6cdc21ae370ed93 diff --git a/include/villas/io.h b/include/villas/io.h index 42bf0f81c..0a1f71aa0 100644 --- a/include/villas/io.h +++ b/include/villas/io.h @@ -138,7 +138,7 @@ int io_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, struct * * @param buf[out] The buffer which should be filled with serialized data. * @param len[in] The length of the buffer \p buf. - * @param rbytes[out] The number of bytes which have been written to \p buf. Ignored if NULL. + * @param rbytes[out] The number of bytes which have been written to \p buf. Ignored if nullptr. * @param smps[in] The array of pointers to samples. * @param cnt[in] The number of pointers in the array \p smps. * diff --git a/include/villas/memory.h b/include/villas/memory.h index c69817ea5..a7d370dac 100644 --- a/include/villas/memory.h +++ b/include/villas/memory.h @@ -70,7 +70,7 @@ int memory_lock(size_t lock); /** Allocate \p len bytes memory of type \p m. * - * @retval NULL If allocation failed. + * @retval nullptr If allocation failed. * @retval <>0 If allocation was successful. */ void * memory_alloc(struct memory_type *m, size_t len); diff --git a/include/villas/pool.h b/include/villas/pool.h index df07aa037..259950080 100644 --- a/include/villas/pool.h +++ b/include/villas/pool.h @@ -83,7 +83,7 @@ INLINE ssize_t pool_put_many(struct pool *p, void *blocks[], size_t cnt) INLINE void * pool_get(struct pool *p) { void *ptr; - return queue_pull(&p->queue, &ptr) == 1 ? ptr : NULL; + return queue_pull(&p->queue, &ptr) == 1 ? ptr : nullptr; } /** Release a memory block back to the pool. */ diff --git a/include/villas/sample.h b/include/villas/sample.h index 5923b90d6..cde004c57 100644 --- a/include/villas/sample.h +++ b/include/villas/sample.h @@ -93,7 +93,7 @@ struct sample { #define SAMPLE_NON_POOL PTRDIFF_MIN /** Get the address of the pool to which the sample belongs. */ -#define sample_pool(s) ((s)->pool_off == SAMPLE_NON_POOL ? NULL : (struct pool *) ((char *) (s) + (s)->pool_off)) +#define sample_pool(s) ((s)->pool_off == SAMPLE_NON_POOL ? nullptr : (struct pool *) ((char *) (s) + (s)->pool_off)) struct sample * sample_alloc(struct pool *p); diff --git a/lib/formats/json.cpp b/lib/formats/json.cpp index a0b53850b..1b75a0293 100644 --- a/lib/formats/json.cpp +++ b/lib/formats/json.cpp @@ -77,8 +77,8 @@ static int json_unpack_timestamps(json_t *json_ts, struct sample *smp) { int ret; json_error_t err; - json_t *json_ts_origin = NULL; - json_t *json_ts_received = NULL; + json_t *json_ts_origin = nullptr; + json_t *json_ts_received = nullptr; json_unpack_ex(json_ts, &err, 0, "{ s?: o, s?: o }", "origin", &json_ts_origin, @@ -185,7 +185,7 @@ static int json_unpack_sample(struct io *io, json_t *json_smp, struct sample *sm { int ret; json_error_t err; - json_t *json_data, *json_value, *json_ts = NULL; + json_t *json_data, *json_value, *json_ts = nullptr; size_t i; int64_t sequence = -1; diff --git a/lib/formats/json_reserve.cpp b/lib/formats/json_reserve.cpp index 2a51ec8df..1a98b8112 100644 --- a/lib/formats/json_reserve.cpp +++ b/lib/formats/json_reserve.cpp @@ -37,8 +37,8 @@ static int json_reserve_pack_sample(struct io *io, json_t **j, struct sample *sm { json_error_t err; json_t *json_data, *json_name, *json_unit, *json_value; - json_t *json_created = NULL; - json_t *json_sequence = NULL; + json_t *json_created = nullptr; + json_t *json_sequence = nullptr; if (smp->flags & (int) SampleFlags::HAS_TS_ORIGIN) json_created = json_integer(time_to_double(&smp->ts.origin) * 1e3); @@ -67,7 +67,7 @@ static int json_reserve_pack_sample(struct io *io, json_t **j, struct sample *sm if (sig->unit) json_unit = json_string(sig->unit); else - json_unit = NULL; + json_unit = nullptr; json_value = json_pack_ex(&err, 0, "{ s: o, s: f }", "name", json_name, @@ -94,7 +94,7 @@ static int json_reserve_pack_sample(struct io *io, json_t **j, struct sample *sm *j = json_pack_ex(&err, 0, "{ s: o }", "measurements", json_data ); - if (*j == NULL) + if (*j == nullptr) return -1; #if 0 #ifdef JSON_RESERVE_INTEGER_TARGET @@ -124,8 +124,8 @@ static int json_reserve_unpack_sample(struct io *io, json_t *json_smp, struct sa int ret, idx; double created = -1; json_error_t err; - json_t *json_value, *json_data = NULL; - json_t *json_origin = NULL, *json_target = NULL; + json_t *json_value, *json_data = nullptr; + json_t *json_origin = nullptr, *json_target = nullptr; size_t i; ret = json_unpack_ex(json_smp, &err, 0, "{ s?: o, s?: o, s?: o, s?: o }", @@ -173,7 +173,7 @@ static int json_reserve_unpack_sample(struct io *io, json_t *json_smp, struct sa smp->length = 0; json_array_foreach(json_data, i, json_value) { - const char *name, *unit = NULL; + const char *name, *unit = nullptr; double value; ret = json_unpack_ex(json_value, &err, 0, "{ s: s, s?: s, s: F, s?: F }", diff --git a/lib/formats/protobuf.cpp b/lib/formats/protobuf.cpp index eb83fc99a..2b764cd09 100644 --- a/lib/formats/protobuf.cpp +++ b/lib/formats/protobuf.cpp @@ -130,14 +130,14 @@ int protobuf_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, struct goto out; villas__node__message__pack(pb_msg, (uint8_t *) buf); - villas__node__message__free_unpacked(pb_msg, NULL); + villas__node__message__free_unpacked(pb_msg, nullptr); *wbytes = psz; return cnt; out: - villas__node__message__free_unpacked(pb_msg, NULL); + villas__node__message__free_unpacked(pb_msg, nullptr); return -1; } @@ -147,7 +147,7 @@ int protobuf_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, s unsigned i, j; Villas__Node__Message *pb_msg; - pb_msg = villas__node__message__unpack(NULL, len, (uint8_t *) buf); + pb_msg = villas__node__message__unpack(nullptr, len, (uint8_t *) buf); if (!pb_msg) return -1; @@ -218,7 +218,7 @@ int protobuf_sscan(struct io *io, const char *buf, size_t len, size_t *rbytes, s if (rbytes) *rbytes = villas__node__message__get_packed_size(pb_msg); - villas__node__message__free_unpacked(pb_msg, NULL); + villas__node__message__free_unpacked(pb_msg, nullptr); return i; }