]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/cfree.3
man*/: ffix (un-bracket tables)
[thirdparty/man-pages.git] / man3 / cfree.3
CommitLineData
a1eaacb1 1'\" t
fea681da
MK
2.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl)
3.\"
e4a74ca8 4.\" SPDX-License-Identifier: GPL-2.0-or-later
fea681da 5.\"
a5ebdc8d 6.TH cfree 3 (date) "Linux man-pages (unreleased)"
fea681da
MK
7.SH NAME
8cfree \- free allocated memory
b813014f
AC
9.SH LIBRARY
10Standard C library
11.RI ( libc ", " \-lc )
fea681da
MK
12.SH SYNOPSIS
13.nf
68e4db0a 14.PP
fea681da 15.B "#include <stdlib.h>"
68e4db0a 16.PP
fea681da
MK
17/* In SunOS 4 */
18.BI "int cfree(void *" ptr );
68e4db0a 19.PP
fea681da
MK
20/* In glibc or FreeBSD libcompat */
21.BI "void cfree(void *" ptr );
68e4db0a 22.PP
fea681da 23/* In SCO OpenServer */
c64cd13e
AC
24.BI "void cfree(char " ptr [. size " * ." num "], unsigned int " num ", \
25unsigned int " size );
68e4db0a 26.PP
fea681da 27/* In Solaris watchmalloc.so.1 */
c64cd13e
AC
28.BI "void cfree(void " ptr [. elsize " * ." nelem "], size_t " nelem ", \
29size_t " elsize );
fea681da 30.fi
68e4db0a 31.PP
d39ad78f 32.RS -4
cc4615cc
MK
33Feature Test Macro Requirements for glibc (see
34.BR feature_test_macros (7)):
d39ad78f 35.RE
68e4db0a 36.PP
cc4615cc 37.BR cfree ():
9d281e06 38.nf
51c612fb
MK
39 Since glibc 2.19:
40 _DEFAULT_SOURCE
75c018a1 41 glibc 2.19 and earlier:
51c612fb 42 _BSD_SOURCE || _SVID_SOURCE
9d281e06 43.fi
fea681da 44.SH DESCRIPTION
c13182ef
MK
45This function should never be used.
46Use
fea681da
MK
47.BR free (3)
48instead.
b324e17d 49Starting with glibc 2.26, it has been removed from glibc.
73d8cece 50.SS 1-arg cfree
fea681da 51In glibc, the function
63aa9df0 52.BR cfree ()
fea681da
MK
53is a synonym for
54.BR free (3),
55"added for compatibility with SunOS".
dd3568a1 56.PP
fea681da
MK
57Other systems have other functions with this name.
58The declaration is sometimes in
59.I <stdlib.h>
60and sometimes in
61.IR <malloc.h> .
73d8cece 62.SS 3-arg cfree
fea681da 63Some SCO and Solaris versions have malloc libraries with a 3-argument
63aa9df0 64.BR cfree (),
fea681da
MK
65apparently as an analog to
66.BR calloc (3).
dd3568a1 67.PP
fea681da 68If you need it while porting something, add
ba39b288 69.PP
088a639b 70.in +4n
ba39b288 71.EX
fea681da 72#define cfree(p, n, s) free((p))
ba39b288 73.EE
fea681da 74.in
ba39b288 75.PP
fea681da 76to your file.
dd3568a1 77.PP
fea681da 78A frequently asked question is "Can I use
fb186734 79.BR free (3)
fea681da 80to free memory allocated with
fb186734 81.BR calloc (3),
fea681da 82or do I need
40725279 83.BR cfree ()?"
fea681da 84Answer: use
fb186734 85.BR free (3).
dd3568a1 86.PP
fea681da 87An SCO manual writes: "The cfree routine is provided for compliance
c13182ef
MK
88to the iBCSe2 standard and simply calls free.
89The num and size
fea681da 90arguments to cfree are not used."
47297adb 91.SH RETURN VALUE
fea681da 92The SunOS version of
63aa9df0 93.BR cfree ()
fea681da 94(which is a synonym for
fb186734 95.BR free (3))
fea681da
MK
96returns 1 on success and 0 on failure.
97In case of error,
98.I errno
a9b4ebbc
MK
99is set to
100.BR EINVAL :
101the value of
fea681da
MK
102.I ptr
103was not a pointer to a block previously allocated by
c13182ef 104one of the routines in the
b5cc2ffb
MK
105.BR malloc (3)
106family.
02db25c3
MS
107.SH ATTRIBUTES
108For an explanation of the terms used in this section, see
109.BR attributes (7).
110.TS
111allbox;
c466875e 112lbx lb lb
02db25c3
MS
113l l l.
114Interface Attribute Value
115T{
9e54434e
BR
116.na
117.nh
02db25c3
MS
118.BR cfree ()
119T} Thread safety MT-Safe /* In glibc */
120.TE
c466875e 121.sp 1
196224f7 122.SH VERSIONS
fea681da 123The 3-argument version of
63aa9df0 124.BR cfree ()
fea681da
MK
125as used by SCO conforms to the iBCSe2 standard:
126Intel386 Binary Compatibility Specification, Edition 2.
4131356c
AC
127.SH STANDARDS
128None.
129.SH HISTORY
130.\" commit 025b33ae84bb8f15b2748a1d8605dca453fce112
131Removed in glibc 2.26.
12960935
MK
132.SH SEE ALSO
133.BR malloc (3)