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- */
15 #include "term/z-virt.h"
18 * @brief str の複製を返す。戻り値は使用後に string_free() で解放すること。
20 * nullptr が渡された場合、nullptr を返す。
22 concptr string_make(const concptr str)
28 const auto bufsize = std::strlen(str) + 1;
29 auto *const buf = new char[bufsize];
30 std::strcpy(buf, str);
36 * @brief string_make() で割り当てたバッファを解放する。
39 * nullptr が渡された場合、何もせず 0 を返す。
41 errr string_free(const concptr str)