diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libc/stdlib/malloc.3 | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/lib/libc/stdlib/malloc.3 b/src/lib/libc/stdlib/malloc.3 index 2647434eaa..8ae3ba20e6 100644 --- a/src/lib/libc/stdlib/malloc.3 +++ b/src/lib/libc/stdlib/malloc.3 | |||
| @@ -30,9 +30,9 @@ | |||
| 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 30 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | .\" SUCH DAMAGE. | 31 | .\" SUCH DAMAGE. |
| 32 | .\" | 32 | .\" |
| 33 | .\" $OpenBSD: malloc.3,v 1.83 2014/10/23 05:48:40 doug Exp $ | 33 | .\" $OpenBSD: malloc.3,v 1.84 2014/10/30 20:43:35 millert Exp $ |
| 34 | .\" | 34 | .\" |
| 35 | .Dd $Mdocdate: October 23 2014 $ | 35 | .Dd $Mdocdate: October 30 2014 $ |
| 36 | .Dt MALLOC 3 | 36 | .Dt MALLOC 3 |
| 37 | .Os | 37 | .Os |
| 38 | .Sh NAME | 38 | .Sh NAME |
| @@ -265,12 +265,13 @@ if ((newp = reallocarray(p, num, size)) == NULL) { | |||
| 265 | ... | 265 | ... |
| 266 | .Ed | 266 | .Ed |
| 267 | .Pp | 267 | .Pp |
| 268 | Code designed for some ancient platforms avoided calling | 268 | Calling |
| 269 | .Fn realloc | 269 | .Fn realloc |
| 270 | with a | 270 | with a |
| 271 | .Dv NULL | 271 | .Dv NULL |
| 272 | .Fa ptr . | 272 | .Fa ptr |
| 273 | Such hacks are no longer necessary in modern code. | 273 | is equivalent to calling |
| 274 | .Fn malloc . | ||
| 274 | Instead of this idiom: | 275 | Instead of this idiom: |
| 275 | .Bd -literal -offset indent | 276 | .Bd -literal -offset indent |
| 276 | if (p == NULL) | 277 | if (p == NULL) |
| @@ -279,12 +280,7 @@ else | |||
| 279 | newp = realloc(p, newsize); | 280 | newp = realloc(p, newsize); |
| 280 | .Ed | 281 | .Ed |
| 281 | .Pp | 282 | .Pp |
| 282 | Use the following as calling | 283 | Use the following: |
| 283 | .Fn realloc | ||
| 284 | with | ||
| 285 | .Dv NULL | ||
| 286 | is equivalent to calling | ||
| 287 | .Fn malloc : | ||
| 288 | .Bd -literal -offset indent | 284 | .Bd -literal -offset indent |
| 289 | newp = realloc(p, newsize); | 285 | newp = realloc(p, newsize); |
| 290 | .Ed | 286 | .Ed |
