Changeset 25891a8 for history.c


Ignore:
Timestamp:
Jun 25, 2011, 6:42:19 AM (10 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.8, release-1.9
Children:
b2bfe1f, af562f5, b8a3e00, e1d3607, 16ce7a4
Parents:
650fb2c
git-author:
David Benjamin <davidben@mit.edu> (06/25/11 04:32:18)
git-committer:
David Benjamin <davidben@mit.edu> (06/25/11 06:42:19)
Message:
Add a unit test for owl_history

Also fix an off-by-one error in bounding the history size. May as well
have those semantics be coherent and testable.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • history.c

    r95b52d1 r25891a8  
    66  h->cur = h->hist.tail;        /* current position in history */
    77  h->partial = false;           /* is the 0th element is partially composed? */
     8}
     9
     10void owl_history_cleanup(owl_history *h)
     11{
     12  g_queue_foreach(&h->hist, (GFunc)g_free, NULL);
     13  g_queue_clear(&h->hist);
    814}
    915
     
    4046
    4147  /* if we've reached the max history size, pop off the last element */
    42   if (g_queue_get_length(&h->hist) > OWL_HISTORYSIZE)
     48  if (g_queue_get_length(&h->hist) >= OWL_HISTORYSIZE)
    4349    g_free(g_queue_pop_head(&h->hist));
    4450
Note: See TracChangeset for help on using the changeset viewer.