Skip to content

Commit d207edb

Browse files
ndrs-pstnashif
authored andcommitted
shell: rename shell_xxx_impl wrapper functions to shell_fprintf_xxx
Since the `_impl` naming convention is intended for internal use only, renaming these functions to the `shell_fprintf_xxx` variant is more suitable for calls outside the module: - `shell_info_impl` to `shell_fprintf_info` - `shell_print_impl` to `shell_fprintf_normal` - `shell_warn_impl` to `shell_fprintf_warn` - `shell_error_impl` to `shell_fprintf_error` Signed-off-by: Pisit Sawangvonganan <[email protected]>
1 parent 79fa6b3 commit d207edb

File tree

3 files changed

+31
-31
lines changed

3 files changed

+31
-31
lines changed

include/zephyr/shell/shell.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,8 +1093,8 @@ void shell_hexdump(const struct shell *sh, const uint8_t *data, size_t len);
10931093
* @param[in] ... List of parameters to print.
10941094
*/
10951095
#define shell_info(_sh, _ft, ...) \
1096-
shell_info_impl(_sh, _ft "\n", ##__VA_ARGS__)
1097-
void __printf_like(2, 3) shell_info_impl(const struct shell *sh, const char *fmt, ...);
1096+
shell_fprintf_info(_sh, _ft "\n", ##__VA_ARGS__)
1097+
void __printf_like(2, 3) shell_fprintf_info(const struct shell *sh, const char *fmt, ...);
10981098

10991099
/**
11001100
* @brief Print normal message to the shell.
@@ -1106,8 +1106,8 @@ void __printf_like(2, 3) shell_info_impl(const struct shell *sh, const char *fmt
11061106
* @param[in] ... List of parameters to print.
11071107
*/
11081108
#define shell_print(_sh, _ft, ...) \
1109-
shell_print_impl(_sh, _ft "\n", ##__VA_ARGS__)
1110-
void __printf_like(2, 3) shell_print_impl(const struct shell *sh, const char *fmt, ...);
1109+
shell_fprintf_normal(_sh, _ft "\n", ##__VA_ARGS__)
1110+
void __printf_like(2, 3) shell_fprintf_normal(const struct shell *sh, const char *fmt, ...);
11111111

11121112
/**
11131113
* @brief Print warning message to the shell.
@@ -1119,8 +1119,8 @@ void __printf_like(2, 3) shell_print_impl(const struct shell *sh, const char *fm
11191119
* @param[in] ... List of parameters to print.
11201120
*/
11211121
#define shell_warn(_sh, _ft, ...) \
1122-
shell_warn_impl(_sh, _ft "\n", ##__VA_ARGS__)
1123-
void __printf_like(2, 3) shell_warn_impl(const struct shell *sh, const char *fmt, ...);
1122+
shell_fprintf_warn(_sh, _ft "\n", ##__VA_ARGS__)
1123+
void __printf_like(2, 3) shell_fprintf_warn(const struct shell *sh, const char *fmt, ...);
11241124

11251125
/**
11261126
* @brief Print error message to the shell.
@@ -1132,8 +1132,8 @@ void __printf_like(2, 3) shell_warn_impl(const struct shell *sh, const char *fmt
11321132
* @param[in] ... List of parameters to print.
11331133
*/
11341134
#define shell_error(_sh, _ft, ...) \
1135-
shell_error_impl(_sh, _ft "\n", ##__VA_ARGS__)
1136-
void __printf_like(2, 3) shell_error_impl(const struct shell *sh, const char *fmt, ...);
1135+
shell_fprintf_error(_sh, _ft "\n", ##__VA_ARGS__)
1136+
void __printf_like(2, 3) shell_fprintf_error(const struct shell *sh, const char *fmt, ...);
11371137

11381138
/**
11391139
* @brief Process function, which should be executed when data is ready in the

subsys/net/lib/shell/net_shell_private.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define PR(fmt, ...) \
1212
do { \
1313
if (sh) { \
14-
shell_print_impl(sh, fmt, ##__VA_ARGS__); \
14+
shell_fprintf_normal(sh, fmt, ##__VA_ARGS__); \
1515
} else { \
1616
printk(fmt, ##__VA_ARGS__); \
1717
} \
@@ -20,7 +20,7 @@
2020
#define PR_SHELL(sh, fmt, ...) \
2121
do { \
2222
if (sh) { \
23-
shell_print_impl(sh, fmt, ##__VA_ARGS__); \
23+
shell_fprintf_normal(sh, fmt, ##__VA_ARGS__); \
2424
} else { \
2525
printk(fmt, ##__VA_ARGS__); \
2626
} \
@@ -29,7 +29,7 @@
2929
#define PR_ERROR(fmt, ...) \
3030
do { \
3131
if (sh) { \
32-
shell_error_impl(sh, fmt, ##__VA_ARGS__); \
32+
shell_fprintf_error(sh, fmt, ##__VA_ARGS__); \
3333
} else { \
3434
printk(fmt, ##__VA_ARGS__); \
3535
} \
@@ -38,7 +38,7 @@
3838
#define PR_INFO(fmt, ...) \
3939
do { \
4040
if (sh) { \
41-
shell_info_impl(sh, fmt, ##__VA_ARGS__); \
41+
shell_fprintf_info(sh, fmt, ##__VA_ARGS__); \
4242
} else { \
4343
printk(fmt, ##__VA_ARGS__); \
4444
} \
@@ -47,7 +47,7 @@
4747
#define PR_WARNING(fmt, ...) \
4848
do { \
4949
if (sh) { \
50-
shell_warn_impl(sh, fmt, ##__VA_ARGS__); \
50+
shell_fprintf_warn(sh, fmt, ##__VA_ARGS__); \
5151
} else { \
5252
printk(fmt, ##__VA_ARGS__); \
5353
} \

subsys/shell/shell.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,10 +1548,10 @@ void shell_vfprintf(const struct shell *sh, enum shell_vt100_color color,
15481548

15491549
/* These functions mustn't be used from shell context to avoid deadlock:
15501550
* - shell_fprintf_impl
1551-
* - shell_info_impl
1552-
* - shell_print_impl
1553-
* - shell_warn_impl
1554-
* - shell_error_impl
1551+
* - shell_fprintf_info
1552+
* - shell_fprintf_normal
1553+
* - shell_fprintf_warn
1554+
* - shell_fprintf_error
15551555
* However, they can be used in shell command handlers.
15561556
*/
15571557
void shell_fprintf_impl(const struct shell *sh, enum shell_vt100_color color,
@@ -1564,7 +1564,7 @@ void shell_fprintf_impl(const struct shell *sh, enum shell_vt100_color color,
15641564
va_end(args);
15651565
}
15661566

1567-
void shell_info_impl(const struct shell *sh, const char *fmt, ...)
1567+
void shell_fprintf_info(const struct shell *sh, const char *fmt, ...)
15681568
{
15691569
va_list args;
15701570

@@ -1573,7 +1573,7 @@ void shell_info_impl(const struct shell *sh, const char *fmt, ...)
15731573
va_end(args);
15741574
}
15751575

1576-
void shell_print_impl(const struct shell *sh, const char *fmt, ...)
1576+
void shell_fprintf_normal(const struct shell *sh, const char *fmt, ...)
15771577
{
15781578
va_list args;
15791579

@@ -1582,7 +1582,7 @@ void shell_print_impl(const struct shell *sh, const char *fmt, ...)
15821582
va_end(args);
15831583
}
15841584

1585-
void shell_warn_impl(const struct shell *sh, const char *fmt, ...)
1585+
void shell_fprintf_warn(const struct shell *sh, const char *fmt, ...)
15861586
{
15871587
va_list args;
15881588

@@ -1591,7 +1591,7 @@ void shell_warn_impl(const struct shell *sh, const char *fmt, ...)
15911591
va_end(args);
15921592
}
15931593

1594-
void shell_error_impl(const struct shell *sh, const char *fmt, ...)
1594+
void shell_fprintf_error(const struct shell *sh, const char *fmt, ...)
15951595
{
15961596
va_list args;
15971597

@@ -1607,35 +1607,35 @@ void shell_hexdump_line(const struct shell *sh, unsigned int offset,
16071607

16081608
int i;
16091609

1610-
shell_print_impl(sh, "%08X: ", offset);
1610+
shell_fprintf_normal(sh, "%08X: ", offset);
16111611

16121612
for (i = 0; i < SHELL_HEXDUMP_BYTES_IN_LINE; i++) {
16131613
if (i > 0 && !(i % 8)) {
1614-
shell_print_impl(sh, " ");
1614+
shell_fprintf_normal(sh, " ");
16151615
}
16161616

16171617
if (i < len) {
1618-
shell_print_impl(sh, "%02x ",
1619-
data[i] & 0xFF);
1618+
shell_fprintf_normal(sh, "%02x ",
1619+
data[i] & 0xFF);
16201620
} else {
1621-
shell_print_impl(sh, " ");
1621+
shell_fprintf_normal(sh, " ");
16221622
}
16231623
}
16241624

1625-
shell_print_impl(sh, "|");
1625+
shell_fprintf_normal(sh, "|");
16261626

16271627
for (i = 0; i < SHELL_HEXDUMP_BYTES_IN_LINE; i++) {
16281628
if (i > 0 && !(i % 8)) {
1629-
shell_print_impl(sh, " ");
1629+
shell_fprintf_normal(sh, " ");
16301630
}
16311631

16321632
if (i < len) {
16331633
char c = data[i];
16341634

1635-
shell_print_impl(sh, "%c",
1636-
isprint((int)c) != 0 ? c : '.');
1635+
shell_fprintf_normal(sh, "%c",
1636+
isprint((int)c) != 0 ? c : '.');
16371637
} else {
1638-
shell_print_impl(sh, " ");
1638+
shell_fprintf_normal(sh, " ");
16391639
}
16401640
}
16411641

0 commit comments

Comments
 (0)