diff options
author | kettenis <> | 2010-03-24 14:47:46 +0000 |
---|---|---|
committer | kettenis <> | 2010-03-24 14:47:46 +0000 |
commit | 542fefa6cf458e6a5d11fdd96dad12cfce6cea05 (patch) | |
tree | bc1bda44d06c93d6c8c4453b273f1dd2adb5e13a /src/lib/libc/string/strdup.3 | |
parent | a8aaee172fe33b2efdcc73260ab4eda0204c336a (diff) | |
download | openbsd-542fefa6cf458e6a5d11fdd96dad12cfce6cea05.tar.gz openbsd-542fefa6cf458e6a5d11fdd96dad12cfce6cea05.tar.bz2 openbsd-542fefa6cf458e6a5d11fdd96dad12cfce6cea05.zip |
Modify example not to use an assignment in the if statement. We shouldn't
teach people bad habits!
ok krw@, jmc@, dlg@, thib@
Diffstat (limited to 'src/lib/libc/string/strdup.3')
-rw-r--r-- | src/lib/libc/string/strdup.3 | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/lib/libc/string/strdup.3 b/src/lib/libc/string/strdup.3 index 5ef38e38f3..60a7462777 100644 --- a/src/lib/libc/string/strdup.3 +++ b/src/lib/libc/string/strdup.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: strdup.3,v 1.14 2007/05/31 19:19:32 jmc Exp $ | 1 | .\" $OpenBSD: strdup.3,v 1.15 2010/03/24 14:47:46 kettenis Exp $ |
2 | .\" | 2 | .\" |
3 | .\" Copyright (c) 1990, 1991, 1993 | 3 | .\" Copyright (c) 1990, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | 4 | .\" The Regents of the University of California. All rights reserved. |
@@ -29,7 +29,7 @@ | |||
29 | .\" | 29 | .\" |
30 | .\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 | 30 | .\" @(#)strdup.3 8.1 (Berkeley) 6/9/93 |
31 | .\" | 31 | .\" |
32 | .Dd $Mdocdate: May 31 2007 $ | 32 | .Dd $Mdocdate: March 24 2010 $ |
33 | .Dt STRDUP 3 | 33 | .Dt STRDUP 3 |
34 | .Os | 34 | .Os |
35 | .Sh NAME | 35 | .Sh NAME |
@@ -59,7 +59,8 @@ to an allocated area of memory containing the NUL-terminated string | |||
59 | .Bd -literal -offset indent | 59 | .Bd -literal -offset indent |
60 | char *p; | 60 | char *p; |
61 | 61 | ||
62 | if ((p = strdup("foobar")) == NULL) { | 62 | p = strdup("foobar"); |
63 | if (p == NULL) { | ||
63 | fprintf(stderr, "Out of memory.\en"); | 64 | fprintf(stderr, "Out of memory.\en"); |
64 | exit(1); | 65 | exit(1); |
65 | } | 66 | } |