#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
Go to the source code of this file.
|
| #define | ARRAYSIZE(array) |
| | 配列のサイズを返すマクロ
|
| #define | FREE(ptr) |
| | メモリを解放するマクロ
|
|
| void * | malloc_chk (size_t size, const char *tag) |
| | mallocを実行し、0で初期化する
|
| void * | calloc_chk (size_t nmemb, size_t size, const char *tag) |
| | 領域の数とサイズを指定してメモリーを確保するcallocを実行する
|
| char * | strdup_chk (const char *s, const char *tag) |
| | malloc_chkを実行してメモリを確保し、コピーした文字列を返す
|
| char * | strndup_chk (const char *s, size_t len, const char *tag) |
| | malloc_chkを実行してメモリを確保し、コピーした文字列の指定した長さの部分を返す
|
| void | strip_end (char *s) |
| | 文字列の末尾から、改行と空白とタブを削除する
|
| void | strip_casl2_comment (char *s) |
| | 文字列から「'」以降の文字列をCASL IIのコメントとして削除する。「''」の場合は除く
|
| char * | strrev (const char *s) |
| | 逆にした文字列を返す
|
◆ ARRAYSIZE
| #define ARRAYSIZE |
( |
| array | ) |
|
Value:(sizeof(array)/sizeof(array[0]))
配列のサイズを返すマクロ
Definition at line 14 of file cmem.h.
◆ FREE
Value:
メモリを解放するマクロ
Definition at line 21 of file cmem.h.
◆ calloc_chk()
| void * calloc_chk |
( |
size_t | nmemb, |
|
|
size_t | size, |
|
|
const char * | tag ) |
領域の数とサイズを指定してメモリーを確保するcallocを実行する
メモリを確保できない場合はエラーを出力して終了
- Parameters
-
| nmemb | 領域の数 |
| size | 領域1個あたりのメモリーサイズ |
| tag | エラーメッセージなどで表示されるタグ |
Definition at line 14 of file cmem.c.
◆ malloc_chk()
| void * malloc_chk |
( |
size_t | size, |
|
|
const char * | tag ) |
mallocを実行し、0で初期化する
メモリを確保できない場合はエラーを出力して終了
- Parameters
-
| size | メモリーのサイズ |
| tag | エラーメッセージなどで表示されるタグ |
Definition at line 3 of file cmem.c.
◆ strdup_chk()
| char * strdup_chk |
( |
const char * | s, |
|
|
const char * | tag ) |
malloc_chkを実行してメモリを確保し、コピーした文字列を返す
- Returns
- コピーした文字列
- Parameters
-
| s | 文字列 |
| tag | エラーメッセージなどで表示されるタグ |
Definition at line 25 of file cmem.c.
◆ strip_casl2_comment()
| void strip_casl2_comment |
( |
char * | s | ) |
|
文字列から「'」以降の文字列をCASL IIのコメントとして削除する。「''」の場合は除く
- Parameters
-
Definition at line 55 of file cmem.c.
◆ strip_end()
| void strip_end |
( |
char * | s | ) |
|
文字列の末尾から、改行と空白とタブを削除する
- Parameters
-
Definition at line 48 of file cmem.c.
◆ strndup_chk()
| char * strndup_chk |
( |
const char * | s, |
|
|
size_t | len, |
|
|
const char * | tag ) |
malloc_chkを実行してメモリを確保し、コピーした文字列の指定した長さの部分を返す
- Returns
- コピーした文字列
- Parameters
-
| s | 文字列 |
| len | 文字列の長さ |
| tag | エラーメッセージなどで表示されるタグ |
Definition at line 33 of file cmem.c.
◆ strrev()
| char * strrev |
( |
const char * | s | ) |
|
逆にした文字列を返す
- Returns
- 逆にしたした文字列
- Parameters
-
Definition at line 71 of file cmem.c.