]> granicus.if.org Git - strace/commitdiff
bpf: remove page size caching
authorEugene Syromyatnikov <evgsyr@gmail.com>
Mon, 5 Mar 2018 09:17:44 +0000 (10:17 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 9 Mar 2018 01:04:28 +0000 (01:04 +0000)
get_pagesize() has a static cache anyway, no need to duplicate it.

* bpf.c (SYS_FUNC(bpf)): Remove static size_t page_size and its
initialisation, use get_pagesize() as the size of buf directly.

bpf.c

diff --git a/bpf.c b/bpf.c
index 0e07444a5db357f2839059cb853df183fdfbce27..e363a71fc18fbecdc9500601a955dae9919542ee 100644 (file)
--- a/bpf.c
+++ b/bpf.c
@@ -409,13 +409,10 @@ SYS_FUNC(bpf)
        int rc;
 
        if (entering(tcp)) {
-               static size_t page_size;
                static char *buf;
 
-               if (!buf) {
-                       page_size = get_pagesize();
-                       buf = xmalloc(page_size);
-               }
+               if (!buf)
+                       buf = xmalloc(get_pagesize());
 
                printxval(bpf_commands, cmd, "BPF_???");
                tprints(", ");