Changeset 9190285 for editwin.c


Ignore:
Timestamp:
Sep 18, 2010, 5:07:40 PM (11 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.7, release-1.8, release-1.9
Children:
c394de8
Parents:
08263a8
git-author:
David Benjamin <davidben@mit.edu> (08/14/10 00:54:38)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 17:07:40)
Message:
Ref-count the editwin
File:
1 edited

Legend:

Unmodified
Added
Removed
  • editwin.c

    r08263a8 r9190285  
    1717
    1818struct _owl_editwin { /*noproto*/
     19  int refcount;
    1920  char *buff;
    2021  owl_history *hist;
     
    7475  e = owl_malloc(sizeof(owl_editwin));
    7576  memset(e, 0, sizeof(*e));
     77  e->refcount = 1;
    7678  return e;
    7779}
    7880
    79 void owl_editwin_delete(owl_editwin *e)
     81static void _owl_editwin_delete(owl_editwin *e)
    8082{
    8183  if (e->win) {
     
    153155  oe_set_window(e, win, winlines, wincols);
    154156  return e;
     157}
     158
     159owl_editwin *owl_editwin_ref(owl_editwin *e)
     160{
     161  e->refcount++;
     162  return e;
     163}
     164
     165void owl_editwin_unref(owl_editwin *e)
     166{
     167  e->refcount--;
     168  if (e->refcount <= 0)
     169    _owl_editwin_delete(e);
    155170}
    156171
Note: See TracChangeset for help on using the changeset viewer.