* make modest_text_utils_get_display_date return a ptr to
[modest] / src / modest-text-utils.c
index 3e61cfc..83de27d 100644 (file)
@@ -1098,16 +1098,17 @@ modest_text_utils_utf8_strcmp (const gchar* s1, const gchar *s2, gboolean insens
 }
 
 
-gchar*
+const gchar*
 modest_text_utils_get_display_date (time_t date)
 {
        time_t now;
-       static const guint BUF_SIZE = 64; 
+#define DATE_BUF_SIZE 64 
        static const guint ONE_DAY = 24 * 60 * 60; /* seconds in one day */
-       gchar date_buf[BUF_SIZE];  
-       gchar today_buf [BUF_SIZE];  
+       static gchar date_buf[DATE_BUF_SIZE];
+
+       gchar today_buf [DATE_BUF_SIZE];  
 
-       modest_text_utils_strftime (date_buf, BUF_SIZE, "%x", date); 
+       modest_text_utils_strftime (date_buf, DATE_BUF_SIZE, "%x", date); 
 
        now = time (NULL);
 
@@ -1119,17 +1120,18 @@ modest_text_utils_get_display_date (time_t date)
                
                /* it's within the last 24 hours, but double check */
                /* use the localized dates */
-               modest_text_utils_strftime (today_buf,  BUF_SIZE, "%x", now); 
+               modest_text_utils_strftime (today_buf,  DATE_BUF_SIZE, "%x", now); 
 
                /* if it's today, use the time instead */
                if (strcmp (date_buf, today_buf) == 0)
-                       modest_text_utils_strftime (date_buf, BUF_SIZE, "%X", date);
+                       modest_text_utils_strftime (date_buf, DATE_BUF_SIZE, "%X", date);
        }
        
-       return g_strdup(date_buf);
+       return date_buf;
 }
 
 
+
 gboolean
 modest_text_utils_validate_folder_name (const gchar *folder_name)
 {