projects
/
YACASL2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
INSTALLドキュメントで、InfoとCASL2LIBのディレクトリー記述を修正
[YACASL2.git]
/
include
/
cmem.h
diff --git
a/include/cmem.h
b/include/cmem.h
index
50a29ec
..
85cb720
100644
(file)
--- a/
include/cmem.h
+++ b/
include/cmem.h
@@
-1,28
+1,54
@@
#ifndef YACASL2_CMEM_H_INCLUDED
#define YACASL2_CMEM_H_INCLUDED
#ifndef YACASL2_CMEM_H_INCLUDED
#define YACASL2_CMEM_H_INCLUDED
-
-#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdbool.h>
+/**
+ * @brief 配列のサイズを返すマクロ
+ */
#ifndef ARRAYSIZE
#define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))
#endif
#ifndef ARRAYSIZE
#define ARRAYSIZE(array) (sizeof(array)/sizeof(array[0]))
#endif
-/* mallocを実行し、0で初期化 */
-/* メモリを確保できない場合はエラーを出力して終了 */
+/**
+ * @brief メモリを解放するマクロ
+ */
+#ifndef FREE
+#define FREE(ptr) {free(ptr); ptr = NULL;}
+#endif
+
+/**
+ * @brief mallocを実行し、0で初期化する
+ *
+ * メモリを確保できない場合はエラーを出力して終了
+ *
+ * @return なし
+ *
+ * @param size メモリーのサイズ
+ * @param tag エラーメッセージなどで表示されるタグ
+ */
void *malloc_chk(size_t size, char *tag);
void *malloc_chk(size_t size, char *tag);
-/* callocを実行 */
-/* メモリを確保できない場合はエラーを出力して終了 */
+/**
+ * @brief 領域の数とサイズを指定してメモリーを確保するcallocを実行する
+ *
+ * メモリを確保できない場合はエラーを出力して終了
+ *
+ * @return なし
+ *
+ * @param nmemb 領域の数
+ * @param size 領域1個あたりのメモリーサイズ
+ * @param tag エラーメッセージなどで表示されるタグ
+ */
void *calloc_chk(size_t nmemb, size_t size, char *tag);
void *calloc_chk(size_t nmemb, size_t size, char *tag);
-/* malloc_chkを実行してメモリを確保してから、 */
-/* コピーした文字列を返す */
+/**
+ * @brief malloc_chkを実行してメモリを確保し、コピーした文字列を返す
+ *
+ * @return コピーした文字列
+ *
+ * @param s 文字列
+ * @param tag エラーメッセージなどで表示されるタグ
+ */
char *strdup_chk(const char *s, char *tag);
char *strdup_chk(const char *s, char *tag);
-/* メモリがNULLの場合は解放 */
-void free_chk(void *ptr, char *tag);
#endif
#endif