1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

follow formatting guidelines

This commit is contained in:
irismarie 2020-03-10 19:01:43 +01:00 committed by Steffen Vogel
parent 38e1193f7e
commit 2f51c6bc3b

View file

@ -35,29 +35,25 @@
int iotagent_ul_sprint(struct io *io, char *buf, size_t len, size_t *wbytes, struct sample *smps[], unsigned cnt)
{
size_t printed = 0;
struct signal * sig;
struct sample * smp = smps[0];
struct signal *sig;
struct sample *smp = smps[0];
unsigned int i;
for (i = 0; i < smp->length && printed < len; i++)
{
for (i = 0; (i < smp->length) && (printed < len); i++) {
sig = (struct signal *) vlist_at_safe(smp->signals, i);
if (!sig)
return -1;
if (sig->name)
{
if (sig->name) {
printed += snprintf(buf + printed, len - printed, "%s|%f|", sig->name, smp->data[i].f);
} else
{
} else {
char name[32];
snprintf(name, 32, "signal_%d", i);
printed += snprintf(buf + printed, len - printed, "%s|%f|", name, smp->data[i].f);
}
}
if (wbytes)
{
if (wbytes) {
*wbytes = printed - 1; // -1 to cut off last '|'
}