diff dwtest.c @ 1873:15d24b5300ec

Third GTK3 round of changes to split string and data in the container control.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 08 Aug 2013 20:28:57 +0000
parents eae36372d64d
children fb137f7f91e4
line wrap: on
line diff
--- a/dwtest.c	Thu Aug 08 18:26:46 2013 +0000
+++ b/dwtest.c	Thu Aug 08 20:28:57 2013 +0000
@@ -1189,7 +1189,6 @@
 void container_add(void)
 {
     char *titles[4];
-    char *names[3];
     char buffer[100];
     unsigned long flags[4] = {   DW_CFA_BITMAPORICON | DW_CFA_LEFT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
         DW_CFA_ULONG | DW_CFA_RIGHT | DW_CFA_HORZSEPARATOR | DW_CFA_SEPARATOR,
@@ -1225,9 +1224,10 @@
 
     for(z=0;z<3;z++)
     {
-        names[z] = (char *)malloc( 100 );
+        char names[100];
+        
         /* yes, there is a memory leak here */
-        sprintf(names[z],"Don't allocate from stack: Item: %d",z);
+        sprintf(names, "We can now allocate from the stack: Item: %d", z);
         size = z*100;
         sprintf(buffer, "Filename %d",z+1);
         if (z == 0 ) thisicon = foldericon;
@@ -1248,7 +1248,7 @@
         date.year = z+2000;
         dw_filesystem_set_item(container, containerinfo, 3, z, &date);
 
-        dw_container_set_row_title(containerinfo, z, names[z]);
+        dw_container_set_row_title(containerinfo, z, names);
         dw_container_set_row_data(containerinfo, z, DW_INT_TO_POINTER(z));
     }