Skip to content

Commit 2e9319d

Browse files
committed
lkl: lib: remove dead code
Remove dead code caught by LLVM. Fixes the following warnings: lib/net.c:44:20: warning: unused function 'set_sockaddr' [-Wunused-function] static inline void set_sockaddr(struct lkl_sockaddr_in *sin, unsigned int addr, lib/config.c:431:16: warning: variable 'bytes_read' set but not used [-Wunused-but-set-variable] int ret = -1, bytes_read = 0; Signed-off-by: Octavian Purdila <tavip@google.com>
1 parent a96c2b3 commit 2e9319d

2 files changed

Lines changed: 2 additions & 10 deletions

File tree

tools/lkl/lib/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ static void add_neighbor(int ifindex, char *entries)
428428
*/
429429
static int dump_file(char *path)
430430
{
431-
int ret = -1, bytes_read = 0;
431+
int ret = -1;
432432
char str[1024] = { 0 };
433433
int fd;
434434

@@ -443,7 +443,7 @@ static int dump_file(char *path)
443443
/* Need to print this out in order to make sense of the output */
444444
lkl_printf("Reading from %s:\n==========\n", path);
445445
while ((ret = lkl_sys_read(fd, str, sizeof(str) - 1)) > 0)
446-
bytes_read += lkl_printf("%s", str);
446+
lkl_printf("%s", str);
447447
lkl_printf("==========\n");
448448

449449
if (ret) {

tools/lkl/lib/net.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,6 @@ int lkl_inet_pton(int af, const char *src, void *dst)
4141
}
4242
#endif
4343

44-
static inline void set_sockaddr(struct lkl_sockaddr_in *sin, unsigned int addr,
45-
unsigned short port)
46-
{
47-
sin->sin_family = LKL_AF_INET;
48-
sin->sin_addr.lkl_s_addr = addr;
49-
sin->sin_port = port;
50-
}
51-
5244
static inline int ifindex_to_name(int sock, struct lkl_ifreq *ifr, int ifindex)
5345
{
5446
ifr->lkl_ifr_ifindex = ifindex;

0 commit comments

Comments
 (0)