Mercurial > hg > nnchat
comparison th_util.c @ 281:8ae649a4b738
Comment.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 09 Jun 2011 19:31:13 +0300 |
parents | 1807059fb8f2 |
children | 18e292701db4 |
comparison
equal
deleted
inserted
replaced
280:922d463ebe9b | 281:8ae649a4b738 |
---|---|
394 | 394 |
395 return NULL; | 395 return NULL; |
396 } | 396 } |
397 | 397 |
398 | 398 |
399 /* | |
400 * Ringbuffers | |
401 */ | |
399 qringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *data)) | 402 qringbuf_t * th_ringbuf_new(const size_t size, void (*mdeallocator)(void *data)) |
400 { | 403 { |
401 qringbuf_t *res = th_calloc(1, sizeof(qringbuf_t)); | 404 qringbuf_t *res = th_calloc(1, sizeof(qringbuf_t)); |
402 | 405 |
403 res->data = (void **) th_malloc(size * sizeof(void *)); | 406 res->data = (void **) th_malloc(size * sizeof(void *)); |
439 memmove(&(buf->data[0]), &(buf->data[1]), buf->size - 1); | 442 memmove(&(buf->data[0]), &(buf->data[1]), buf->size - 1); |
440 buf->data[buf->size - 1] = ptr; | 443 buf->data[buf->size - 1] = ptr; |
441 } | 444 } |
442 } | 445 } |
443 | 446 |
444 |