cfreeのヘルプ・マニュアル
日本語 英語
cfree --help
man cfree
CFREE(3) Linux Programmer’s Manual CFREE(3)
名前
cfree - 割り当てられたメモリを解放する
書式
#include
/* SunOS 4 では */
int cfree(void *ptr);
/* glibc と FreeBSD libcompat では */
void cfree(void *ptr);
/* SCO OpenServer では */
void cfree(char *ptr, unsigned num, unsigned size);
/* Solaris watchmalloc.so.1 では */
void cfree(void *ptr, size_t nelem, size_t elsize);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
cfree(): _BSD_SOURCE || _SVID_SOURCE
説明
この関数は決して使用すべきではない。代わりに free(3) を使うこと。
引き数が 1 つの cfree
glibc では、関数 cfree() は free(3) の別名であり、「SunOS との互換性の
ために追加された」。
他のシステムでは、この名前の別の関数がある。この宣言は に 存
在する場合もあるし、 に存在する場合もある。
引き数が 3 つの cfree
SCO と Solaris のいくつかのバージョンでは、引き数が 3 つの cfree() が含
まれる malloc ライブラリがある。これは明らかに calloc(3) に類似している
。
何かを移植する時にこの関数が必要な場合、
#define cfree(p, n, s) free((p))
をファイルに追加すること。
よ く 尋ねられる質問は 「calloc(3) で割り当てられたメモリを解放するのに
free(3) を使うことができるか、それとも cfree() を使う必要があるか」とい
うものである。答え: free(3) を使うこと。
SCO の マ ニ ュアルには以下のように記述されている: 「cfree ルーチンは
iBCSe2 規格に従うために提供されており、単に free を呼んでいるだけである
。 cfree の num と size 引き数は使用されない。」
返り値
SunOS 版の cfree() (free(3) の別名) は、成功した場合に 1 を返し、失敗し
た場合に 0 を返す。エラーの場合、 errno が EINVAL に設定される: ptr の
値が malloc() 系のルーチンの 1 つで以前に割り当てられたブロックへのポイ
ンタでない。
準拠
SCO で用いられている引き数が 3 つの cfree() は、iBCSe2 規 格: Intel386
Binary Compatibility Specification, Edition 2 (Intel386 バイナリ互換仕
様、第 2 版) に準拠する。
関連項目
malloc(3)
2007-07-26 CFREE(3)
CFREE(3) Linux Programmer’s Manual CFREE(3)
NAME
cfree - free allocated memory
SYNOPSIS
#include
/* In SunOS 4 */
int cfree(void *ptr);
/* In glibc or FreeBSD libcompat */
void cfree(void *ptr);
/* In SCO OpenServer */
void cfree(char *ptr, unsigned num, unsigned size);
/* In Solaris watchmalloc.so.1 */
void cfree(void *ptr, size_t nelem, size_t elsize);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
cfree(): _BSD_SOURCE || _SVID_SOURCE
DESCRIPTION
This function should never be used. Use free(3) instead.
1-arg cfree
In glibc, the function cfree() is a synonym for free(3), "added for
compatibility with SunOS".
Other systems have other functions with this name. The declaration is
sometimes in and sometimes in .
3-arg cfree
Some SCO and Solaris versions have malloc libraries with a 3-argument
cfree(), apparently as an analog to calloc(3).
If you need it while porting something, add
#define cfree(p, n, s) free((p))
to your file.
A frequently asked question is "Can I use free(3) to free memory allo-
cated with calloc(3), or do I need cfree()?" Answer: use free(3).
An SCO manual writes: "The cfree routine is provided for compliance to
the iBCSe2 standard and simply calls free. The num and size arguments
to cfree are not used."
RETURN VALUE
The SunOS version of cfree() (which is a synonym for free(3)) returns 1
on success and 0 on failure. In case of error, errno is set to EINVAL:
the value of ptr was not a pointer to a block previously allocated by
one of the routines in the malloc(3) family.
CONFORMING TO
The 3-argument version of cfree() as used by SCO conforms to the iBCSe2
standard: Intel386 Binary Compatibility Specification, Edition 2.
SEE ALSO
malloc(3)
COLOPHON
This page is part of release 3.22 of the Linux man-pages project. A
description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
2007-07-26 CFREE(3)