/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/Error.c

  • Committer: Gustav Hartvigsson
  • Date: 2016-02-01 14:29:35 UTC
  • mfrom: (121.1.4 simpletypesystem_gc)
  • Revision ID: gustav.hartvigsson@gmail.com-20160201142935-tz7ef63id2g3yfof
* Merged GC branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
 
89
89
SError *
90
90
s_error_new (void) {
91
 
  SError * self = malloc (sizeof (SError));
 
91
  SError * self = s_malloc (sizeof (SError));
92
92
  self->error_list = s_linked_list_new (FREEFUNC (_internal_s_error_item_free));
93
93
  return self;
94
94
}
106
106
    return;
107
107
  }
108
108
 
109
 
  SErrorItem * item = malloc (sizeof (SErrorItem));
 
109
  SErrorItem * item = s_malloc (sizeof (SErrorItem));
110
110
 
111
111
  item->message = s_string_new (message);
112
112
  item->error_type = error;
143
143
void
144
144
s_error_free (SError * self) {
145
145
  s_linked_list_free (self->error_list, TRUE);
146
 
  free (self);
 
146
  s_free (self);
147
147
}
148
148
 
149
149
void
176
176
          s_dynamic_array_new (S_ERROR_DOMAIN_RANGE_MAX,
177
177
          FREEFUNC (_internal_s_error_domain_item_free));
178
178
    // The default key is always 0
179
 
    item = malloc (sizeof (SErrorDomainItem));
 
179
    item = s_malloc (sizeof (SErrorDomainItem));
180
180
    item->domain = 0;
181
181
    item->to_string_func = s_default_error_domain_to_string;
182
182
    item->domain_name = s_string_new ("default");
202
202
    /*
203
203
     * The item dose not exist in the array, lets just add it.
204
204
     */
205
 
    item = malloc (sizeof (SErrorDomainItem));
 
205
    item = s_malloc (sizeof (SErrorDomainItem));
206
206
    item->domain = domain;
207
207
    item->to_string_func = to_string_func;
208
208
    item->domain_name = s_string_new (name);
251
251
       domain <= s_dynamic_array_size (_internal_s_error_domain_list) + 1;
252
252
       domain++) {
253
253
    if (!(s_dynamic_array_get(_internal_s_error_domain_list ,domain))) {
254
 
      item = malloc (sizeof (SErrorDomainItem));
 
254
      item = s_malloc (sizeof (SErrorDomainItem));
255
255
      item->domain = domain;
256
256
      item->domain_name = s_string_new (name);
257
257
      item->to_string_func = to_string_func;
277
277
  s_dbg_print ("(SErrorDomainItem) Freeing: %d, %s",
278
278
               self->domain,
279
279
               self->domain_name);
280
 
  free (self->domain_name);
281
 
  free (self);
 
280
  s_free (self->domain_name);
 
281
  s_free (self);
282
282
}
283
283
 
284
284
void
297
297
void
298
298
_internal_s_error_item_free (SErrorItem * self) {
299
299
  s_dbg_print ("Running free on errori item!");
300
 
  free (self->message);
301
 
  free (self);
 
300
  s_free (self->message);
 
301
  s_free (self);
302
302
}