mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-04 03:36:34 +02:00
Added vpbuffer utility functions
This commit is contained in:
parent
1551c9a8b7
commit
4cb5b1db40
2 changed files with 25 additions and 0 deletions
|
@ -1428,6 +1428,16 @@ typedef union {
|
||||||
/**@}*/
|
/**@}*/
|
||||||
/**@}*/
|
/**@}*/
|
||||||
|
|
||||||
|
typedef struct vpbuffer_t vpbuffer;
|
||||||
|
struct vpbuffer_t {
|
||||||
|
void **buf;
|
||||||
|
int len;
|
||||||
|
int count;
|
||||||
|
};
|
||||||
|
|
||||||
|
vpbuffer *vp_create(void);
|
||||||
|
void vp_add(vpbuffer *v, void *obj);
|
||||||
|
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
void **vpbuffer_realloc(void **buf, int *len);
|
void **vpbuffer_realloc(void **buf, int *len);
|
||||||
void **vpbuffer_add(void **buf, int *len, int i, void *obj);
|
void **vpbuffer_add(void **buf, int *len, int i, void *obj);
|
||||||
|
|
15
runtime.c
15
runtime.c
|
@ -6435,6 +6435,21 @@ void vpbuffer_free(void **buf)
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vpbuffer *vp_create(void)
|
||||||
|
{
|
||||||
|
vpbuffer *v = malloc(sizeof(vpbuffer));
|
||||||
|
v->len = 128;
|
||||||
|
v->count = 0;
|
||||||
|
v->buf = NULL;
|
||||||
|
v->buf = vpbuffer_realloc(v->buf, &(v->len));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vp_add(vpbuffer *v, void *obj)
|
||||||
|
{
|
||||||
|
v->buf = vpbuffer_add(v->buf, &(v->len), v->count++, obj);
|
||||||
|
}
|
||||||
|
|
||||||
object Cyc_bit_unset(void *data, object n1, object n2)
|
object Cyc_bit_unset(void *data, object n1, object n2)
|
||||||
{
|
{
|
||||||
Cyc_check_int(data, n1);
|
Cyc_check_int(data, n1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue