diff options
Diffstat (limited to 'plugins/NewStory/src/templates.h')
-rw-r--r-- | plugins/NewStory/src/templates.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/plugins/NewStory/src/templates.h b/plugins/NewStory/src/templates.h index 4349ea79d5..2368aa731b 100644 --- a/plugins/NewStory/src/templates.h +++ b/plugins/NewStory/src/templates.h @@ -9,22 +9,26 @@ enum struct TemplateVars { - bool del[256]; - wchar_t* val[256]; + struct { + wchar_t *val; + bool del; + } + vars[256]; __forceinline wchar_t* GetVar(uint8_t id) { - return val[id]; + return vars[id].val; } __forceinline void SetVar(uint8_t id, const wchar_t *v, bool d) { - if (val[id] && del[id]) - mir_free(val[id]); - val[id] = mir_wstrdup(v); - del[id] = d; + auto &V = vars[id]; + if (V.val && V.del) + mir_free(V.val); + V.val = mir_wstrdup(v); + V.del = d; } }; -typedef void(*VarFunc)(int mode, TemplateVars* vars, MCONTACT hContact, ItemData* item); +typedef void (*VarFunc)(int mode, TemplateVars *vars, MCONTACT hContact, ItemData *item); struct TemplateInfo { |