diff options
author | Alejandro Colomar <alx@kernel.org> | 2023-11-21 16:30:12 +0100 |
---|---|---|
committer | Alejandro Colomar <alx@kernel.org> | 2023-11-21 19:30:47 +0100 |
commit | ab40ee7c8451c186783ea63aefde8585de7485a9 (patch) | |
tree | 00ee11acb70658a99603196cc8e3df8f001fdb6b | |
parent | 0ccb05aec41e106febb8d832ce256ec7c70bc981 (diff) |
strncat.3: EXAMPLES: Fix name of variable
It was called maxsize, but it was really a number of elements. And it
wasn't maximum; it was exact.
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r-- | man3/strncat.3 | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/man3/strncat.3 b/man3/strncat.3 index 59ec0bc2e..8a563645e 100644 --- a/man3/strncat.3 +++ b/man3/strncat.3 @@ -93,7 +93,7 @@ Shlemiel the painter int main(void) { - size_t maxsize; + size_t n; \& // Null-padded fixed-size character sequences char pre[4] = "pre."; @@ -104,9 +104,8 @@ main(void) char src[] = "some_long_body.post"; char *dest; \& - maxsize = nitems(pre) + strlen(src) \- strlen(post) + - nitems(new_post) + 1; - dest = malloc(sizeof(*dest) * maxsize); + n = nitems(pre) + strlen(src) \- strlen(post) + nitems(new_post) + 1; + dest = malloc(sizeof(*dest) * n); if (dest == NULL) err(EXIT_FAILURE, "malloc()"); \& |