4 * Copyright (c) 1997 Ben Harrison
6 * This software may be copied and distributed for educational, research,
7 * and not for profit purposes provided that this copyright and statement
8 * are included in all such copies.
11 /* Purpose: Memory management routines -BEN- */
13 #include "term/z-virt.h"
17 * @brief str の複製を返す。戻り値は使用後に string_free() で解放すること。
19 * nullptr が渡された場合、nullptr を返す。
21 const char *string_make(const char *str)
27 const auto bufsize = std::strlen(str) + 1;
28 auto *const buf = new char[bufsize];
29 std::strcpy(buf, str);
35 * @brief string_make() で割り当てたバッファを解放する。
38 * nullptr が渡された場合、何もせず 0 を返す。
40 int string_free(const char *str)