aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <colomar.6.4.3@gmail.com>2020-09-03 21:55:48 +0200
committerMichael Kerrisk <mtk.manpages@gmail.com>2020-09-05 14:49:42 +0200
commit5780a2e7984ef2e42b8d3841c33afdfd67ba6a8d (patch)
tree4fafceed316d3219ece8b069830985bb5d152e66
parenta899cafef489c6df272d9e2f0a3324845b3b7d76 (diff)
downloadman-pages-5780a2e7984ef2e42b8d3841c33afdfd67ba6a8d.tar.gz
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 <colomar.6.4.3@gmail.com> Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/shm_open.34
1 files changed, 2 insertions, 2 deletions
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)