Changeset 7dcef03 for message.c


Ignore:
Timestamp:
Dec 25, 2013, 11:33:37 AM (8 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
  • message.c

    r2354e9a r7dcef03  
    7070
    7171  if(pair ==  NULL) {
    72     pair = g_new(owl_pair, 1);
     72    pair = g_slice_new(owl_pair);
    7373    owl_pair_create(pair, attrname, NULL);
    7474    g_ptr_array_add(m->attributes, pair);
     
    10191019    p = m->attributes->pdata[i];
    10201020    g_free(owl_pair_get_value(p));
    1021     g_free(p);
     1021    g_slice_free(owl_pair, p);
    10221022  }
    10231023
     
    10301030{
    10311031  owl_message_cleanup(m);
    1032   g_free(m);
    1033 }
     1032  g_slice_free(owl_message, m);
     1033}
Note: See TracChangeset for help on using the changeset viewer.