/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/Box.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:
34
34
 */
35
35
SBox *
36
36
internal_s_box_new () {
37
 
  SBox * self = malloc (sizeof (SBox));
38
 
  SBoxClass * klass = malloc (sizeof (SBoxClass));
 
37
  SBox * self = s_malloc (sizeof (SBox));
 
38
  SBoxClass * klass = s_malloc (sizeof (SBoxClass));
39
39
  s_object_initialize (S_OBJECT (self), "SBox");
40
40
 
41
41
  s_object_set_class (S_OBJECT (self),
337
337
        if (free_func) {
338
338
          free_func (priv->data.m_ptr);
339
339
        } else {
340
 
          free (priv->data.m_ptr);
 
340
          s_free (priv->data.m_ptr);
341
341
        }
342
342
        break;
343
343
      case S_TYPE_STRING:
344
 
        free (priv->data.m_string);
 
344
        s_free (priv->data.m_string);
345
345
        break;
346
346
      case S_TYPE_WSTRING:
347
 
        free (priv->data.m_wstring);
 
347
        s_free (priv->data.m_wstring);
348
348
        break;
349
349
      default:
350
350
        s_warn_print ("[SBox] free_data was set despite not being an object"
352
352
    }
353
353
  }
354
354
 
355
 
  free (self->priv);
356
 
  free (klass);
 
355
  s_free (self->priv);
 
356
  s_free (klass);
357
357
 
358
358
}
359
359