add init.c, force BUG_ON in safe_malloc()

This commit is contained in:
2024-05-14 11:39:37 +02:00
parent a0b1d289a7
commit 7baf66f1b6
4 changed files with 58 additions and 2 deletions

42
src/init.c Normal file
View File

@@ -0,0 +1,42 @@
/* init.c - initialize all.
*
* Copyright (C) 2024 Bruno Raoult ("br")
* Licensed under the GNU General Public License v3.0 or later.
* Some rights reserved. See COPYING.
*
* You should have received a copy of the GNU General Public License along with this
* program. If not, see <https://www.gnu.org/licenses/gpl-3.0-standalone.html>.
*
* SPDX-License-Identifier: GPL-3.0-or-later <https://spdx.org/licenses/GPL-3.0-or-later.html>
*
*/
#include <stdio.h>
#include <locale.h>
#include "chessdefs.h"
#include "bitboard.h"
#include "hyperbola-quintessence.h"
#include "hash.h"
void init_all()
{
/* for printf() numeric thousands separator */
setlocale(LC_NUMERIC, "");
/* line-buffered stdout */
setlinebuf(stdout);
/* pseudo random generator seed */
rand_init(RAND_SEED_DEFAULT);
/* bitboards & hq */
bitboard_init();
hyperbola_init();
/* zobrist tables & default tt hashtable */
zobrist_init();
hash_create(HASH_DEFAULT);
}