From 98fd23afed142dbe63e87fad74444cce47c6446a Mon Sep 17 00:00:00 2001 From: s1lent Date: Sun, 19 Nov 2017 03:24:56 +0700 Subject: [PATCH] Fix parse --- metamod/src/mlist.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/metamod/src/mlist.cpp b/metamod/src/mlist.cpp index 04d40d5..be3b2b2 100644 --- a/metamod/src/mlist.cpp +++ b/metamod/src/mlist.cpp @@ -193,7 +193,6 @@ MPlugin* MPluginList::plugin_addload(plid_t plid, const char* fname, PLUG_LOADTI MPlugin* MPluginList::add(MPlugin* padd) { auto plug = new MPlugin(); - memset(plug, 0, sizeof(MPlugin)); plug->m_index = ++m_last_index; @@ -323,12 +322,25 @@ bool MPluginList::ini_refresh() if ((cp = Q_strrchr(line, '\n'))) *cp = '\0'; + trimbuf(line); + + // skip empty lines + if (line[0] == '\0') { + continue; + } + + // skip comments + if (line[0] == '#' || line[0] == ';' || !Q_strncmp(line, "//", 2)) { + continue; + } + // Parse into a temp plugin - MPlugin pl_temp = {}; + MPlugin pl_temp{}; if (!pl_temp.ini_parseline(line)) { META_ERROR("ini: Skipping malformed line %d of %s", ln, m_inifile); continue; } + // Try to find plugin with this pathname in the current list of // plugins. auto pl_found = find(pl_temp.m_pathname);