diff mcabber/src/screen.c @ 419:2f9852610cf4

Small code review Some clean up and security checks
author Mikael Berthe <mikael@lilotux.net>
date Fri, 02 Sep 2005 20:34:17 +0200
parents 9c640ee3bae3
children b44be19d6229
line wrap: on
line diff
--- a/mcabber/src/screen.c	Thu Sep 01 23:48:46 2005 +0200
+++ b/mcabber/src/screen.c	Fri Sep 02 20:34:17 2005 +0200
@@ -301,7 +301,7 @@
 
   tmp->win = newwin(lines, cols, y, x);
   while (!tmp->win) {
-    usleep(250);
+    safe_usleep(250);
     tmp->win = newwin(lines, cols, y, x);
   }
   wbkgd(tmp->win, COLOR_PAIR(COLOR_GENERAL));
@@ -393,7 +393,7 @@
     // You need to set it to the whole prefix length + 1
     if (line) {
       if (line->timestamp) {
-        strftime(date, 35, "%m-%d %H:%M", localtime(&line->timestamp));
+        strftime(date, 30, "%m-%d %H:%M", localtime(&line->timestamp));
       } else
         strcpy(date, "           ");
       if (line->flags & HBB_PREFIX_INFO) {
@@ -1159,8 +1159,7 @@
     // First message line (we skip leading empty lines)
     num = 0;
     if (line[0]) {
-      multiline = g_new(char, strlen(line)+1);
-      strcpy(multiline, line);
+      multiline = g_strdup(line);
       num++;
     } else
       return;
@@ -1327,7 +1326,8 @@
   }
 
   strcpy(tmpLine, ptr_inputline);
-  strcpy(ptr_inputline, text);    ptr_inputline += len;
+  strcpy(ptr_inputline, text);
+  ptr_inputline += len;
   strcpy(ptr_inputline, tmpLine);
 }
 
@@ -1535,8 +1535,7 @@
           } else {                  // down-history
             // Use next history line instead of a blank line
             const char *l = scr_cmdhisto_next("", 0);
-            if (l)
-              strcpy(inputLine, l);
+            if (l) strcpy(inputLine, l);
             // Reset backup history line
             cmdhisto_backup[0] = 0;
           }
@@ -1545,18 +1544,14 @@
           {
             const char *l = scr_cmdhisto_prev(inputLine,
                     ptr_inputline-inputLine);
-            if (l) {
-              strcpy(inputLine, l);
-            }
+            if (l) strcpy(inputLine, l);
           }
           break;
       case KEY_DOWN:
           {
             const char *l = scr_cmdhisto_next(inputLine,
                     ptr_inputline-inputLine);
-            if (l) {
-              strcpy(inputLine, l);
-            }
+            if (l) strcpy(inputLine, l);
           }
           break;
       case KEY_PPAGE: