Changeset 7dcef03 for logging.c


Ignore:
Timestamp:
Dec 25, 2013, 11:33:37 AM (7 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master
Children:
8f95fc4, db1a2f8b, c53f5e8, 1bd5aa9
Parents:
d779a1a
git-author:
Anders Kaseorg <andersk@mit.edu> (12/25/13 11:18:38)
git-committer:
Anders Kaseorg <andersk@mit.edu> (12/25/13 11:33:37)
Message:
Use the Glib slice allocator for fixed-size objects

The slice allocator, available since GLib 2.10, is more
space-efficient than [g_]malloc.  Since BarnOwl is obviously at the
leading edge of space-efficient technology, this seems like a natural
fit.  Use it for every fixed-size object except
owl_viewwin_search_data (which would need an extra destroy_cbdata
function to g_slice_free it).

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • logging.c

    r0792d99 r7dcef03  
    177177    g_free(msg->message);
    178178    g_free(msg->filename);
    179     g_free(msg);
     179    g_slice_free(owl_log_entry, msg);
    180180  }
    181181}
     
    184184{
    185185  owl_log_entry *log_msg = NULL;
    186   log_msg = g_new(owl_log_entry,1);
     186  log_msg = g_slice_new(owl_log_entry);
    187187  log_msg->message = g_strdup(buffer);
    188188  log_msg->filename = g_strdup(filename);
     
    266266   * owl_log_shouldlog_message(void)
    267267   */
    268   m = g_new(owl_message, 1);
     268  m = g_slice_new(owl_message);
    269269  /* recip_index = 0 because there can only be one recipient anyway */
    270270  owl_message_create_from_zwrite(m, zw, text, 0);
Note: See TracChangeset for help on using the changeset viewer.