/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/baseobject.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:
99
99
 
100
100
  self->callbacks = s_map_new (COMPFUNC (s_string_is_equal),
101
101
                               HASH_FUNC (sdbm_hash),
102
 
                               FREEFUNC (free),
 
102
                               FREEFUNC (s_free),
103
103
                               FREEFUNC (s_callback_entry_free));
104
104
 
105
105
  s_object_set_free_method (self, method_base_free);
113
113
s_object_new () {
114
114
  s_warn_print ("s_object_new () should never be used in production code");
115
115
 
116
 
  SObject * self = malloc (sizeof (SObject));
 
116
  SObject * self = s_malloc (sizeof (SObject));
117
117
  //allocate the class definition of the object.
118
 
  self->base_class = malloc (sizeof(SObjectClass));
 
118
  self->base_class = s_malloc (sizeof(SObjectClass));
119
119
  //initialize it.
120
120
  s_object_initialize (self, "SObject");
121
121
  return self;
123
123
 
124
124
void
125
125
s_object_free (SObject * self) {
126
 
  free (self->name);
 
126
  s_free (self->name);
127
127
  s_map_free (self->callbacks, TRUE);
128
128
  SObjectClass * klass = s_object_get_class (self);
129
129
  klass->free (self);
172
172
 
173
173
void
174
174
method_base_free (SObject * self) {
175
 
  free (self->base_class);
176
 
  free (self);
 
175
  s_free (self->base_class);
 
176
  s_free (self);
177
177
}
178
178
 
179
179
int