/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 src/baseobject.c

  • Committer: Gustav Hartvigsson
  • Date: 2015-04-28 12:25:20 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20150428122520-n90grm1k1l318ooa
* Finnished SLinkedList.
  * Still needs to be tested.
* Made s_object_initialize take the name of the class
* made s_object_free free the name
* fixed s_dynamic_array_free. It now takes a sboolean to tell it
  to free the data in the array or not.
* fixed a typo in defs.h
* fixed the the test of the dynamic array.
* switched (SObject *) to S_OBJECT () for casting in SError.
* changed hash_t to size_t.
* general code cleanup.

Show diffs side-by-side

added added

removed removed

Lines of Context:
89
89
  klass->deinitialize = method;
90
90
}
91
91
 
92
 
void s_object_initialize (SObject * self) {
 
92
void s_object_initialize (SObject * self, const char * name) {
 
93
  self->name = s_string_new (name);
 
94
  
93
95
  self->refcount = 1;
 
96
  
94
97
  s_object_set_deinitialize_method (self,method_base_deinitialize);
95
98
  s_object_set_initialize_method (self, method_base_initialize);
96
99
  s_object_set_free_method (self, method_base_free);
107
110
  //allocate the class definition of the object.
108
111
  self->base_class = malloc (sizeof(SObjectClass));
109
112
  //initialize it.
110
 
  s_object_initialize (self);
 
113
  s_object_initialize (self, "SObject");
111
114
  return self;
112
115
}
113
116
 
114
117
void s_object_free (SObject * self) {
 
118
  free (self->name);
115
119
  SObjectClass * klass = s_object_get_class (self);
116
120
  klass->free (self);
117
121
}