diff main.c @ 535:379e361f1144

Fix various segfault issues.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Aug 2012 02:17:03 +0300
parents 52c56ada3816
children 15e447d6a2a6
line wrap: on
line diff
--- a/main.c	Thu Jun 07 03:16:56 2012 +0300
+++ b/main.c	Tue Aug 14 02:17:03 2012 +0300
@@ -482,8 +482,8 @@
         {
            if (checkNameList(setFriendList, name))
            {
-               colorNick = 5;
-               colorText = 1;
+               colorNick = 11;
+               colorText = 0;
            }
            else
            {
@@ -1506,6 +1506,13 @@
 }
 
 
+void clearEditState(nn_editstate_t *st)
+{
+    memset(st, 0, sizeof(nn_editstate_t));
+    st->insertMode = TRUE;
+    st->debugMsg = debugMsg;
+}
+
 int main(int argc, char *argv[])
 {
     char *tmpStr;
@@ -1518,9 +1525,7 @@
     char *setHomeDir = NULL;
 
     memset(editHistBuf, 0, sizeof(editHistBuf));
-    memset(&editState, 0, sizeof(editState));
-    editState.insertMode = TRUE;
-    editState.debugMsg = debugMsg;
+    clearEditState(&editState);
 
     // Initialize
     th_init("NNChat", "Newbie Nudes chat client", NN_VERSION,
@@ -1857,7 +1862,7 @@
     {
         char *tmp;
         printMsg(NULL, "Press enter to exit.\n");
-        memset(&editState, 0, sizeof(editState));
+        clearEditState(&editState);
         tmp = nnwin_prompt_requester(FALSE, &editState, processUserPrompt, updateUserPrompt);
         th_free(tmp);
     }