Skip to content

Commit ed60003

Browse files
committed
iiod: Use snprintf instead of iio_snprintf
iio_snprintf is a libiio internal function, which we don't really need in IIOD anyway. Signed-off-by: Paul Cercueil <[email protected]>
1 parent 5f57e44 commit ed60003

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

iiod/dns-sd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void start_avahi_thd(struct thread_pool *pool, void *d)
259259
if (ret || !strcmp(host, "none"))
260260
goto again;
261261

262-
iio_snprintf(label, sizeof(label), "%s%s", IIOD_ON, host);
262+
snprintf(label, sizeof(label), "%s%s", IIOD_ON, host);
263263

264264
if (!avahi.name)
265265
avahi.name = avahi_strdup(label);

iiod/iiod.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ static const char *options_descriptions[] = {
9393
"Specify the number of USB pipes (ep couples) to use",
9494
};
9595

96-
9796
static void usage(void)
9897
{
9998
unsigned int i;

iiod/ops.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ static void print_value(struct parser_pdata *pdata, long value)
343343
output(pdata, "\n");
344344
} else {
345345
char buf[128];
346-
iio_snprintf(buf, sizeof(buf), "%li\n", value);
346+
snprintf(buf, sizeof(buf), "%li\n", value);
347347
output(pdata, buf);
348348
}
349349
}
@@ -424,7 +424,7 @@ static ssize_t send_data(struct DevEntry *dev, struct ThdEntry *thd, size_t len)
424424
/* Send the current mask */
425425
for (i = dev->nb_words; i > 0 && ptr < buf + sizeof(buf);
426426
i--, ptr += 8) {
427-
iio_snprintf(ptr, length, "%08x", mask[i - 1]);
427+
snprintf(ptr, length, "%08x", mask[i - 1]);
428428
length -= 8;
429429
}
430430

@@ -830,7 +830,7 @@ static uint32_t *get_mask(const char *mask, size_t *len)
830830
ptr = words + nb;
831831
while (*mask) {
832832
char buf[9];
833-
iio_snprintf(buf, sizeof(buf), "%.*s", 8, mask);
833+
snprintf(buf, sizeof(buf), "%.*s", 8, mask);
834834
sscanf(buf, "%08x", --ptr);
835835
mask += 8;
836836
IIO_DEBUG("Mask[%lu]: 0x%08x\n",
@@ -1255,7 +1255,7 @@ ssize_t get_trigger(struct parser_pdata *pdata, struct iio_device *dev)
12551255
ret = strlen(trigger->name);
12561256
print_value(pdata, ret);
12571257

1258-
iio_snprintf(buf, sizeof(buf), "%s\n", trigger->name);
1258+
snprintf(buf, sizeof(buf), "%s\n", trigger->name);
12591259
ret = write_all(pdata, buf, ret + 1);
12601260
} else {
12611261
print_value(pdata, ret);

iiod/usbd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ static int usb_open_pipe(struct usbd_pdata *pdata, unsigned int pipe_id)
101101
* before opening the endpoints again. */
102102
thread_pool_stop_and_wait(pdata->pool[pipe_id]);
103103

104-
iio_snprintf(buf, sizeof(buf), "%s/ep%u", pdata->ffs, pipe_id * 2 + 1);
104+
snprintf(buf, sizeof(buf), "%s/ep%u", pdata->ffs, pipe_id * 2 + 1);
105105
cpdata->ep_out = open(buf, O_WRONLY);
106106
if (cpdata->ep_out < 0) {
107107
err = -errno;
108108
goto err_free_cpdata;
109109
}
110110

111-
iio_snprintf(buf, sizeof(buf), "%s/ep%u", pdata->ffs, pipe_id * 2 + 2);
111+
snprintf(buf, sizeof(buf), "%s/ep%u", pdata->ffs, pipe_id * 2 + 2);
112112
cpdata->ep_in = open(buf, O_RDONLY);
113113
if (cpdata->ep_in < 0) {
114114
err = -errno;
@@ -357,7 +357,7 @@ int start_usb_daemon(struct iio_context *ctx, const char *ffs,
357357
goto err_free_pdata_pool;
358358
}
359359

360-
iio_snprintf(buf, sizeof(buf), "%s/ep0", ffs);
360+
snprintf(buf, sizeof(buf), "%s/ep0", ffs);
361361

362362
pdata->ep0_fd = open(buf, O_RDWR);
363363
if (pdata->ep0_fd < 0) {

0 commit comments

Comments
 (0)