mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
replace NULL by nullptr
This commit is contained in:
parent
150d4591fd
commit
ef1c339433
8 changed files with 19 additions and 19 deletions
2
common
2
common
|
@ -1 +1 @@
|
|||
Subproject commit c423c60f502a189bb636ce1c669e15438ee89299
|
||||
Subproject commit 39e23fc9a7234e7a235efd49e6cdc21ae370ed93
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 }",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue