/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/RingBuffer.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:
12
12
 
13
13
SRingBuffer *
14
14
s_ring_buffer_new (size_t len) {
15
 
  SRingBuffer * self = malloc (sizeof (SRingBuffer));
16
 
  self->array = calloc (len, size_t (sbyte));
 
15
  SRingBuffer * self = s_malloc (sizeof (SRingBuffer));
 
16
  self->array = s_calloc (len, size_t (sbyte));
17
17
  
18
18
  self->len = len;
19
19
  self->start = 0;
25
25
 
26
26
void
27
27
s_ring_buffer_free (SRingBuffer * self) {
28
 
  free (self->array);
29
 
  free (self);
 
28
  s_free (self->array);
 
29
  s_free (self);
30
30
}
31
31
 
32
32
sboolean