.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl) .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2004 Yuichi SATO .\" all rights reserved. .\" Translated Mon Jul 19 04:38:03 JST 2004 .\" by Yuichi SATO .\" .TH CFREE 3 2007\-07\-26 "" "Linux Programmer's Manual" .SH 名前 cfree \- 割り当てられたメモリーを解放する .SH 書式 .nf .sp \fB#include \fP .sp /* SunOS 4 では */ \fBint cfree(void *\fP\fIptr\fP\fB);\fP .sp /* glibc と FreeBSD libcompat では */ \fBvoid cfree(void *\fP\fIptr\fP\fB);\fP .sp /* SCO OpenServer では */ \fBvoid cfree(char *\fP\fIptr\fP\fB, unsigned \fP\fInum\fP\fB, unsigned \fP\fIsize\fP\fB);\fP .sp /* Solaris watchmalloc.so.1 では */ \fBvoid cfree(void *\fP\fIptr\fP\fB, size_t \fP\fInelem\fP\fB, size_t \fP\fIelsize\fP\fB);\fP .fi .sp .in -4n glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .in .sp \fBcfree\fP(): _BSD_SOURCE || _SVID_SOURCE .SH 説明 この関数は決して使用すべきではない。 代わりに \fBfree\fP(3) を使うこと。 .SS "引き数が 1 つの cfree" glibc では、関数 \fBcfree\fP() は \fBfree\fP(3) の別名であり、「SunOS との互換性のために追加された」。 .LP 他のシステムでは、この名前の別の関数がある。 この宣言は \fI\fP に存在する場合もあるし、 \fI\fP に存在する場合もある。 .SS "引き数が 3 つの cfree" SCO と Solaris のいくつかのバージョンでは、 引き数が 3 つの \fBcfree\fP() が含まれる malloc ライブラリがある。 これは明らかに \fBcalloc\fP(3) に類似している。 .LP 何かを移植する時にこの関数が必要な場合、 .sp .in +4n #define cfree(p, n, s) free((p)) .in .sp をファイルに追加すること。 .LP よく尋ねられる質問は 「\fBcalloc\fP(3) で割り当てられたメモリーを解放するのに \fBfree\fP(3) を使うことができるか、 それとも \fBcfree\fP() を使う必要があるか」というものである。 答え: \fBfree\fP(3) を使うこと。 .LP SCO のマニュアルには以下のように記述されている: 「cfree ルーチンは iBCSe2 規格に従うために提供されており、 単に free を呼んでいるだけである。 cfree の num と size 引き数は使用されない。」 .SH 返り値 SunOS 版の \fBcfree\fP() (\fBfree\fP(3) の別名) は、成功した場合に 1 を返し、失敗した場合に 0 を返す。 エラーの場合、 \fIerrno\fP が \fBEINVAL\fP に設定される: \fIptr\fP の値が \fBmalloc\fP() 系のルーチンの 1 つで以前に割り当てられた ブロックへのポインターでない。 .SH 準拠 SCO で用いられている引き数が 3 つの \fBcfree\fP() は、iBCSe2 規格: Intel386 Binary Compatibility Specification, Edition 2 (Intel386 バイナリ互換仕様、第 2 版) に準拠する。 .SH 関連項目 \fBmalloc\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部 である。プロジェクトの説明とバグ報告に関する情報は http://www.kernel.org/doc/man\-pages/ に書かれている。