• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 14554080340

19 Apr 2025 11:46AM UTC coverage: 72.101% (-0.03%) from 72.13%
14554080340

push

github

web-flow
Add two new paragraphs to coding style about header files (#37188)

296880 of 411754 relevant lines covered (72.1%)

687547.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

81.25
/src/basic/format-ifname.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "format-ifname.h"
4
#include "log.h"
5
#include "stdio-util.h"
6
#include "string-util.h"
7

8
assert_cc(STRLEN("%") + DECIMAL_STR_MAX(int) <= IF_NAMESIZE);
9

10
int format_ifname_full(int ifindex, FormatIfnameFlag flag, char buf[static IF_NAMESIZE]) {
1,613✔
11
        if (ifindex <= 0)
1,613✔
12
                return -EINVAL;
13

14
        if (if_indextoname(ifindex, buf))
1,585✔
15
                return 0;
16

17
        if (!FLAGS_SET(flag, FORMAT_IFNAME_IFINDEX))
150✔
18
                return -errno;
150✔
19

20
        if (FLAGS_SET(flag, FORMAT_IFNAME_IFINDEX_WITH_PERCENT))
×
21
                assert_se(snprintf_ok(buf, IF_NAMESIZE, "%%%d", ifindex));
×
22
        else
23
                assert_se(snprintf_ok(buf, IF_NAMESIZE, "%d", ifindex));
×
24

25
        return 0;
26
}
27

28
int format_ifname_full_alloc(int ifindex, FormatIfnameFlag flag, char **ret) {
1,195✔
29
        char buf[IF_NAMESIZE];
1,195✔
30
        int r;
1,195✔
31

32
        assert(ret);
1,195✔
33

34
        r = format_ifname_full(ifindex, flag, buf);
1,195✔
35
        if (r < 0)
1,195✔
36
                return r;
1,195✔
37

38
        return strdup_to(ret, buf);
1,042✔
39
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc