Changeset a1074de for dict.c


Ignore:
Timestamp:
Mar 7, 2010, 10:26:09 PM (11 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.6, release-1.7, release-1.8, release-1.9
Children:
bf7aa1d
Parents:
0e57335
git-author:
Anders Kaseorg <andersk@mit.edu> (02/27/10 22:21:53)
git-committer:
Anders Kaseorg <andersk@mit.edu> (03/07/10 22:26:09)
Message:
owl_dict_insert_element: Rename free_on_replace argument to delete_on_replace.

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

Legend:

Unmodified
Added
Removed
  • dict.c

    r0f15f12 ra1074de  
    7171}
    7272
    73 void owl_dict_noop_free(void *x) {
     73void owl_dict_noop_delete(void *x)
     74{
    7475  return;
    7576}
     
    7778/* Returns 0 on success.  Will copy the key but make
    7879   a reference to the value.  Will clobber an existing
    79    entry with the same key iff free_on_replace!=NULL,
    80    and will run free_on_replace on the old element.
     80   entry with the same key iff delete_on_replace!=NULL,
     81   and will run delete_on_replace on the old element.
    8182   Will return -2 if replace=NULL and match was found.
    8283*/
    83 int owl_dict_insert_element(owl_dict *d, const char *k, void *v, void (*free_on_replace)(void *old)) {
     84int owl_dict_insert_element(owl_dict *d, const char *k, void *v, void (*delete_on_replace)(void *old))
     85{
    8486  int pos, found;
    8587  char *dupk;
    8688  found = _owl_dict_find_pos(d, k, &pos);
    87   if (found && free_on_replace) {
    88     free_on_replace(d->els[pos].v);
     89  if (found && delete_on_replace) {
     90    delete_on_replace(d->els[pos].v);
    8991    d->els[pos].v = v;
    9092    return(0);
    91   } else if (found && !free_on_replace) {
     93  } else if (found && !delete_on_replace) {
    9294    return(-2);
    9395  } else {
Note: See TracChangeset for help on using the changeset viewer.