[PATCH 03/13] tftp: minor refactoring of RRQ/WRQ packet generation code

Enrico Scholz enrico.scholz at sigma-chemnitz.de
Mon Jul 18 05:22:18 PDT 2022


Having 11 printf arguments with lot of them being 0, makes it
difficulty to read and extend.

Add some comments and use '\0' for %c.

Signed-off-by: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
---
 fs/tftp.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/tftp.c b/fs/tftp.c
index d186e7983a6d..13334baaf892 100644
--- a/fs/tftp.c
+++ b/fs/tftp.c
@@ -135,13 +135,13 @@ static int tftp_send(struct file_priv *priv)
 				"%lld%c"
 				"blksize%c"
 				"1432",
-				priv->filename + 1, 0,
-				0,
-				0,
-				TIMEOUT, 0,
-				0,
-				priv->filesize, 0,
-				0);
+				priv->filename + 1, '\0',
+				'\0',	/* "octet" */
+				'\0',	/* "timeout" */
+				TIMEOUT, '\0',
+			        '\0',	/* "tsize" */
+				priv->filesize, '\0',
+			       '\0');	/* "blksize" */
 		pkt++;
 		len = pkt - xp;
 		break;
-- 
2.36.1




More information about the barebox mailing list