projects
/
convexer.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactor el big #2
[convexer.git]
/
src
/
cxr_mem.h
diff --git
a/src/cxr_mem.h
b/src/cxr_mem.h
index 23e61c4e8bec26aa925aa2cd742466a709de0171..437831489ce2c741a810b00401730467abf9b38d 100644
(file)
--- a/
src/cxr_mem.h
+++ b/
src/cxr_mem.h
@@
-1,6
+1,6
@@
-typedef struct cxr_a
uto_buffer cxr_auto_
buffer;
+typedef struct cxr_a
buffer cxr_a
buffer;
-struct cxr_a
uto_
buffer
+struct cxr_abuffer
{
u8 *arr;
u32 esize,
{
u8 *arr;
u32 esize,
@@
-16,7
+16,7
@@
struct cxr_auto_buffer
#define cxr_ab_ptr(b,i) __cxr_ab_ptr(b,i)
#endif
#define cxr_ab_ptr(b,i) __cxr_ab_ptr(b,i)
#endif
-static void *__cxr_ab_ptr( struct cxr_a
uto_
buffer *buffer, u32 index
+static void *__cxr_ab_ptr( struct cxr_abuffer *buffer, u32 index
#ifdef CXR_DEBUG_ALLOCATORS
,const char *debug_str
#ifdef CXR_DEBUG_ALLOCATORS
,const char *debug_str
@@
-36,7
+36,7
@@
static void *__cxr_ab_ptr( struct cxr_auto_buffer *buffer, u32 index
return buffer->arr + buffer->esize*index;
}
return buffer->arr + buffer->esize*index;
}
-static void cxr_ab_reserve( struct cxr_a
uto_
buffer *buffer, u32 count )
+static void cxr_ab_reserve( struct cxr_abuffer *buffer, u32 count )
{
if( buffer->count + count > buffer->capacity )
{
{
if( buffer->count + count > buffer->capacity )
{
@@
-45,13
+45,13
@@
static void cxr_ab_reserve( struct cxr_auto_buffer *buffer, u32 count )
}
}
}
}
-static void *cxr_ab_empty( struct cxr_a
uto_
buffer *buffer )
+static void *cxr_ab_empty( struct cxr_abuffer *buffer )
{
cxr_ab_reserve( buffer, 1 );
return cxr_ab_ptr( buffer, buffer->count ++ );
}
{
cxr_ab_reserve( buffer, 1 );
return cxr_ab_ptr( buffer, buffer->count ++ );
}
-static void *cxr_ab_empty_at( struct cxr_a
uto_
buffer *buffer, int at )
+static void *cxr_ab_empty_at( struct cxr_abuffer *buffer, int at )
{
cxr_ab_reserve( buffer, 1 );
{
cxr_ab_reserve( buffer, 1 );
@@
-61,7
+61,7
@@
static void *cxr_ab_empty_at( struct cxr_auto_buffer *buffer, int at )
return cxr_ab_ptr( buffer, at );
}
return cxr_ab_ptr( buffer, at );
}
- /
/ Shift rest 1 right
+ /
* Shift buffer to make room */
memmove
(
cxr_ab_ptr( buffer, at+1 ),
memmove
(
cxr_ab_ptr( buffer, at+1 ),
@@
-73,7
+73,7
@@
static void *cxr_ab_empty_at( struct cxr_auto_buffer *buffer, int at )
return cxr_ab_ptr( buffer, at );
}
return cxr_ab_ptr( buffer, at );
}
-static void cxr_ab_push( struct cxr_a
uto_
buffer *buffer, void *em )
+static void cxr_ab_push( struct cxr_abuffer *buffer, void *em )
{
cxr_ab_reserve( buffer, 1 );
{
cxr_ab_reserve( buffer, 1 );
@@
-81,7
+81,7
@@
static void cxr_ab_push( struct cxr_auto_buffer *buffer, void *em )
buffer->count ++;
}
buffer->count ++;
}
-static void cxr_ab_init( struct cxr_a
uto_
buffer *buffer, u32 esize, u32 cap )
+static void cxr_ab_init( struct cxr_abuffer *buffer, u32 esize, u32 cap )
{
buffer->esize = esize;
buffer->capacity = cxr_max(1,cap);
{
buffer->esize = esize;
buffer->capacity = cxr_max(1,cap);
@@
-90,12
+90,12
@@
static void cxr_ab_init( struct cxr_auto_buffer *buffer, u32 esize, u32 cap )
buffer->arr = malloc( buffer->esize*buffer->capacity );
}
buffer->arr = malloc( buffer->esize*buffer->capacity );
}
-static void cxr_ab_clear( struct cxr_a
uto_
buffer *buffer )
+static void cxr_ab_clear( struct cxr_abuffer *buffer )
{
buffer->count = 0;
}
{
buffer->count = 0;
}
-static void cxr_ab_free( struct cxr_a
uto_
buffer *buffer )
+static void cxr_ab_free( struct cxr_abuffer *buffer )
{
free( buffer->arr );
}
{
free( buffer->arr );
}