1CFREE(3)                   Linux Programmer's Manual                  CFREE(3)
2
3
4

NAME

6       cfree - free allocated memory
7

SYNOPSIS

9       #include <stdlib.h>
10
11       /* In SunOS 4 */
12       int cfree(void *ptr);
13
14       /* In glibc or FreeBSD libcompat */
15       void cfree(void *ptr);
16
17       /* In SCO OpenServer */
18       void cfree(char *ptr, unsigned num, unsigned size);
19
20       /* In Solaris watchmalloc.so.1 */
21       void cfree(void *ptr, size_t nelem, size_t elsize);
22

DESCRIPTION

24       This function should never be used. Use free(3) instead.
25
26   1-arg cfree
27       In  glibc,  the  function  cfree() is a synonym for free(3), "added for
28       compatibility with SunOS".
29
30       Other systems have other functions with this name.  The declaration  is
31       sometimes in <stdlib.h> and sometimes in <malloc.h>.
32
33   3-arg cfree
34       Some  SCO  and Solaris versions have malloc libraries with a 3-argument
35       cfree(), apparently as an analog to calloc(3).
36
37       If you need it while porting something, add
38
39            #define cfree(p, n, s) free((p))
40
41       to your file.
42
43       A frequently asked question is "Can I use free() to free  memory  allo‐
44       cated with calloc(), or do I need cfree()?"  Answer: use free().
45
46       An  SCO manual writes: "The cfree routine is provided for compliance to
47       the iBCSe2 standard and simply calls free. The num and  size  arguments
48       to cfree are not used."
49

RETURN VALUE

51       The  SunOS version of cfree() (which is a synonym for free()) returns 1
52       on success and 0 on failure.  In case of error, errno is set to EINVAL:
53       the  value  of ptr was not a pointer to a block previously allocated by
54       one of the routines in the malloc(3) family.
55

CONFORMING TO

57       The 3-argument version of cfree() as used by SCO conforms to the iBCSe2
58       standard: Intel386 Binary Compatibility Specification, Edition 2.
59
60
61
62                                  2003-11-18                          CFREE(3)
Impressum