mirror of https://github.com/mkerrisk/man-pages
open_by_handle_at.2: 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>
This commit is contained in:
parent
d60a7a9a4b
commit
aff660d379
|
@ -586,7 +586,7 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Reallocate file_handle structure with correct size */
|
||||
|
||||
fhsize = sizeof(struct file_handle) + fhp\->handle_bytes;
|
||||
fhsize = sizeof(*fhp) + fhp\->handle_bytes;
|
||||
fhp = realloc(fhp, fhsize); /* Copies fhp\->handle_bytes */
|
||||
if (fhp == NULL)
|
||||
errExit("realloc");
|
||||
|
@ -707,7 +707,7 @@ main(int argc, char *argv[])
|
|||
|
||||
/* Given handle_bytes, we can now allocate file_handle structure */
|
||||
|
||||
fhp = malloc(sizeof(struct file_handle) + handle_bytes);
|
||||
fhp = malloc(sizeof(*fhp) + handle_bytes);
|
||||
if (fhp == NULL)
|
||||
errExit("malloc");
|
||||
|
||||
|
|
Loading…
Reference in New Issue