Skip to content

Commit e5aaf21

Browse files
Xavier Chaproncarlescufi
authored andcommitted
subsys: Replace printf by printk when applicable
Signed-off-by: Xavier Chapron <[email protected]>
1 parent 2a8ff02 commit e5aaf21

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

subsys/debug/thread_analyzer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static void thread_analyze_cb(const struct k_thread *cthread, void *user_data)
6161
name = k_thread_name_get((k_tid_t)thread);
6262
if (!name || name[0] == '\0') {
6363
name = hexname;
64-
sprintf(hexname, "%p", (void *)thread);
64+
snprintk(hexname, sizeof(hexname), "%p", (void *)thread);
6565
}
6666

6767
err = k_thread_stack_space_get(thread, &unused);

subsys/logging/log_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ void log_output_dropped_process(const struct log_output *log_output, u32_t cnt)
659659
struct device *dev = (struct device *)log_output->control_block->ctx;
660660

661661
cnt = MIN(cnt, 9999);
662-
len = snprintf(buf, sizeof(buf), "%d", cnt);
662+
len = snprintk(buf, sizeof(buf), "%d", cnt);
663663

664664
buffer_write(outf, (u8_t *)prefix, sizeof(prefix) - 1, dev);
665665
buffer_write(outf, buf, len, dev);

subsys/net/lib/lwm2m/lwm2m_rw_json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ int do_write_op_json(struct lwm2m_message *msg)
823823
}
824824

825825
/* combine base_name + name */
826-
snprintf(full_name, sizeof(full_name), "%s%s",
826+
snprintk(full_name, sizeof(full_name), "%s%s",
827827
base_name, value);
828828

829829
/* parse full_name into path */

subsys/net/lib/lwm2m/lwm2m_rw_plain_text.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ size_t plain_text_put_float32fix(struct lwm2m_output_context *out,
129129
char buf[sizeof("000000")];
130130

131131
/* value of 123 -> "000123" -- ignore sign */
132-
len = snprintf(buf, sizeof(buf), "%06d", abs(value->val2));
132+
len = snprintk(buf, sizeof(buf), "%06d", abs(value->val2));
133133
if (len != 6U) {
134134
strcpy(buf, "0");
135135
} else {

subsys/net/lib/openthread/platform/diag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ void otPlatDiagProcess(otInstance *aInstance,
2727
ARG_UNUSED(aInstance);
2828

2929
/* Add more plarform specific diagnostics features here. */
30-
snprintf(aOutput, aOutputMaxLen,
30+
snprintk(aOutput, aOutputMaxLen,
3131
"diag feature '%s' is not supported\r\n", argv[0]);
3232
}
3333

subsys/net/lib/openthread/platform/shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static int ot_cmd(const struct shell *shell, size_t argc, char *argv[])
5252
buf_ptr += arg_len + 1;
5353
}
5454

55-
arg_len = snprintf(buf_ptr, buf_len, "%s", argv[i]);
55+
arg_len = snprintk(buf_ptr, buf_len, "%s", argv[i]);
5656

5757
if (arg_len >= buf_len) {
5858
shell_fprintf(shell, SHELL_WARNING,

subsys/net/lib/sockets/getnameinfo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ int zsock_getnameinfo(const struct sockaddr *addr, socklen_t addrlen,
2525
}
2626

2727
if (serv != NULL) {
28-
snprintf(serv, servlen, "%hu", ntohs(a->sin_port));
28+
snprintk(serv, servlen, "%hu", ntohs(a->sin_port));
2929
}
3030

3131
return 0;

0 commit comments

Comments
 (0)