From: Lennart Poettering Date: Tue, 8 Jun 2021 16:52:43 +0000 (+0200) Subject: bpf-program: use structured initialization when allocating BPFProgram objects X-Git-Tag: v249-rc1~57^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06ad9d0c125b8b3f2650d383469a3bbe3e58b041;p=thirdparty%2Fsystemd.git bpf-program: use structured initialization when allocating BPFProgram objects --- diff --git a/src/shared/bpf-program.c b/src/shared/bpf-program.c index ec8437d583b..8bcdf6a9b43 100644 --- a/src/shared/bpf-program.c +++ b/src/shared/bpf-program.c @@ -59,13 +59,15 @@ static int bpf_program_get_info_by_fd(int prog_fd, struct bpf_prog_info *info, u int bpf_program_new(uint32_t prog_type, BPFProgram **ret) { _cleanup_(bpf_program_unrefp) BPFProgram *p = NULL; - p = new0(BPFProgram, 1); + p = new(BPFProgram, 1); if (!p) return -ENOMEM; - p->n_ref = 1; - p->prog_type = prog_type; - p->kernel_fd = -1; + *p = (BPFProgram) { + .n_ref = 1, + .prog_type = prog_type, + .kernel_fd = -1, + }; *ret = TAKE_PTR(p);