1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

add some fixes to ini.c

This commit is contained in:
FunkyFr3sh 2023-10-19 00:45:09 +02:00
parent e92e01ec97
commit 802f55dff4

View File

@ -17,6 +17,7 @@ void ini_create(INIFILE* ini, char* filename)
if (ini->sections)
{
strncpy(ini->filename, filename, sizeof(ini->filename) - 1);
ini->filename[sizeof(ini->filename) - 1] = 0;
char* names = calloc(BUF_SIZE, 1);
if (names)
@ -156,6 +157,11 @@ int ini_get_int(INIFILE* ini, LPCSTR section, LPCSTR key, int def)
void ini_free(INIFILE* ini)
{
if (!ini)
return;
ini->filename[0] = 0;
if (ini->sections)
{
for (int i = 0; ini->sections[i].hash; i++)