/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/Map.c

  • Committer: Gustav Hartvigsson
  • Date: 2016-02-01 14:11:35 UTC
  • mto: This revision was merged to the branch mainline in revision 122.
  • Revision ID: gustav.hartvigsson@gmail.com-20160201141135-pcl4m4gcf8r7t11e
* Made the GC switchable at rutime (once) when compiled with S_USE_GC set.
* replaced:
  * malloc ->   s_malloc
  * free ->     s_free
  * realloc ->  s_realloc
  * calloc ->   s_calloc

* Made s_[malloc, calloc, free, realloc] functions and moved them to their own file.
  This can be used os basis for other memory stuffs in the future, if we want to use
  a Slab allocator or something else.

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
 
58
58
SMapItem *
59
59
s_map_item_new (void * key, void * value) {
60
 
  SMapItem * self = malloc (sizeof (SMapItem));
 
60
  SMapItem * self = s_malloc (sizeof (SMapItem));
61
61
  self->key = key;
62
62
  self->value = value;
63
63
 
77
77
    s_dbg_print ("Freeing Value");
78
78
    free_value (self->value);
79
79
  }
80
 
  free (self);
 
80
  s_free (self);
81
81
}
82
82
 
83
83
 
87
87
           FreeFunc free_key,
88
88
           FreeFunc free_value) {
89
89
  s_dbg_print ("Freeing SMap");
90
 
  SMap * self = malloc (sizeof (SMap));
 
90
  SMap * self = s_malloc (sizeof (SMap));
91
91
  self->len = 0;
92
92
 
93
93
  self->is_equal = comp_func;
123
123
                  free_data);
124
124
 
125
125
  s_dynamic_array_free (self->array, TRUE);
126
 
  free (self);
 
126
  s_free (self);
127
127
}
128
128
 
129
129
void
259
259
    s_dbg_print ("Freeing K:V pair");
260
260
    s_map_item_free (item, map->free_key, map->free_value);
261
261
  } else {
262
 
    free (item);
 
262
    s_free (item);
263
263
  }
264
264
}
265
265