reallocarray.3 (7757a1b4dc60696d9a95137ee0a2accd4ee680f4) reallocarray.3 (3ef1b3b5358f2d9672bca211231b9bba8f759502)
1.\"
2.\" Copyright (c) 1980, 1991, 1993
1.\" Copyright (c) 1980, 1991, 1993
3.\">----The Regents of the University of California. All rights reserved.
2.\" The Regents of the University of California. All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" the American National Standards Committee X3, on Information
7.\" Processing Systems.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:

--- 27 unchanged lines hidden (view full) ---

39.Lb libc
40.Sh SYNOPSIS
41.In stdlib.h
42.Ft void *
43.Fn reallocarray "void *ptr" "size_t nmemb" "size_t size"
44.Sh DESCRIPTION
45The
46.Fn reallocarray
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" the American National Standards Committee X3, on Information
6.\" Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:

--- 27 unchanged lines hidden (view full) ---

38.Lb libc
39.Sh SYNOPSIS
40.In stdlib.h
41.Ft void *
42.Fn reallocarray "void *ptr" "size_t nmemb" "size_t size"
43.Sh DESCRIPTION
44The
45.Fn reallocarray
46function is similar to the
47.Fn realloc
48function
47except it operates on
48.Fa nmemb
49members of size
50.Fa size
51and checks for integer overflow in the calculation
52.Fa nmemb
53*
54.Fa size .
55.Sh RETURN VALUES
49except it operates on
50.Fa nmemb
51members of size
52.Fa size
53and checks for integer overflow in the calculation
54.Fa nmemb
55*
56.Fa size .
57.Sh RETURN VALUES
58The
56.Fn reallocarray
59.Fn reallocarray
57return a pointer to the allocated space; otherwise, a
60function returns a pointer to the allocated space; otherwise, a
58.Dv NULL
59pointer is returned and
60.Va errno
61is set to
62.Er ENOMEM .
63.Sh EXAMPLES
64Consider
65.Fn reallocarray

--- 61 unchanged lines hidden (view full) ---

127.Bd -literal -offset indent
128if ((newp = reallocarray(p, num, size)) == NULL) {
129 ...
130.Ed
131.Sh SEE ALSO
132.Xr realloc 3
133.Sh HISTORY
134The
61.Dv NULL
62pointer is returned and
63.Va errno
64is set to
65.Er ENOMEM .
66.Sh EXAMPLES
67Consider
68.Fn reallocarray

--- 61 unchanged lines hidden (view full) ---

130.Bd -literal -offset indent
131if ((newp = reallocarray(p, num, size)) == NULL) {
132 ...
133.Ed
134.Sh SEE ALSO
135.Xr realloc 3
136.Sh HISTORY
137The
135.Fn reallocf
138.Fn reallocarray
136function first appeared in
139function first appeared in
137.Ox 5.6 .
140.Ox 5.6
141and
142.Fx 11.0 .