Changeset 219f52c for messagelist.c


Ignore:
Timestamp:
Jan 23, 2012, 5:27:42 PM (9 years ago)
Author:
Jason Gross <jgross@mit.edu>
Branches:
master, release-1.9
Children:
d126a19
Parents:
ab88b05
git-author:
Jason Gross <jgross@mit.edu> (07/23/11 23:09:55)
git-committer:
Jason Gross <jgross@mit.edu> (01/23/12 17:27:42)
Message:
Allocate owl_messagelist on the heap

This lets us return NULL from owl_global_get_messagelist before the
messagelist has been initilized.

Since g has static duration, g.ml is automatically initialized to NULL.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • messagelist.c

    rf271129 r219f52c  
    11#include "owl.h"
    22
    3 void owl_messagelist_create(owl_messagelist *ml)
     3CALLER_OWN owl_messagelist *owl_messagelist_new(void)
    44{
     5  owl_messagelist *ml = g_new(owl_messagelist, 1);
    56  ml->list = g_ptr_array_new();
     7  return ml;
    68}
    79
    8 void owl_messagelist_cleanup(owl_messagelist *ml, bool free_messages)
     10void owl_messagelist_delete(owl_messagelist *ml, bool free_messages)
    911{
    1012  if (free_messages)
    1113    g_ptr_array_foreach(ml->list, (GFunc)owl_message_delete, NULL);
    1214  g_ptr_array_free(ml->list, true);
     15  g_free(ml);
    1316}
    1417
Note: See TracChangeset for help on using the changeset viewer.