[Kst] kdeextragear-2/kst/kst

Adriaan de Groot groot at kde.org
Sun Jul 11 13:03:12 CEST 2004


CVS commit by adridg: 

Don't use alloca(), it's asking for a world of (portability) hurt.


  M +4 -3      emailthread.cpp   1.2


--- kdeextragear-2/kst/kst/emailthread.cpp  #1.1:1.2
@@ -16,5 +16,4 @@
  ***************************************************************************/
 
-#include <alloca.h>
 #include <netdb.h>
 #include <sys/socket.h>
@@ -132,5 +131,5 @@ void EMailThread::read( QSocketDevice& s
   QString responseLine;
   QString strWrite;
-  char*   pRead;
+  char*   pRead = NULL;
   int     iLength;
   int     iLengthRead;
@@ -138,5 +137,5 @@ void EMailThread::read( QSocketDevice& s
   iLength = socketDevice.waitForMore(0, NULL);
   if( iLength != -1 ) {
-    pRead = (char*)alloca(iLength);
+    pRead = new char[iLength];
     iLengthRead = socketDevice.readBlock(pRead, iLength);
     if( iLengthRead != -1 ) {
@@ -183,4 +182,6 @@ void EMailThread::read( QSocketDevice& s
     _state = Close;
   }
+
+  delete[] pRead;
 }
 





More information about the Kst mailing list