From: Alejandro Colomar Date: Thu, 3 Sep 2020 19:55:48 +0000 (+0200) Subject: shm_open.3: Use sizeof consistently X-Git-Tag: man-pages-5.09~448 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5780a2e7984ef2e42b8d3841c33afdfd67ba6a8d;p=thirdparty%2Fman-pages.git shm_open.3: Use sizeof consistently Use ``sizeof`` consistently through all the examples in the following way: - Use the name of the variable instead of its type as argument for ``sizeof``. Rationale: https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory Signed-off-by: Alejandro Colomar Signed-off-by: Michael Kerrisk --- diff --git a/man3/shm_open.3 b/man3/shm_open.3 index bba4eb8266..24cc6a4032 100644 --- a/man3/shm_open.3 +++ b/man3/shm_open.3 @@ -382,7 +382,7 @@ main(int argc, char *argv[]) /* Map the object into the caller\(aqs address space */ - struct shmbuf *shmp = mmap(NULL, sizeof(struct shmbuf), + struct shmbuf *shmp = mmap(NULL, sizeof(*shmp), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (shmp == MAP_FAILED) @@ -471,7 +471,7 @@ main(int argc, char *argv[]) if (fd == \-1) errExit("shm_open"); - struct shmbuf *shmp = mmap(NULL, sizeof(struct shmbuf), + struct shmbuf *shmp = mmap(NULL, sizeof(*shmp), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (shmp == MAP_FAILED)