From 394d1b0b282727d994a1ab03fc209d7ada870147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Thu, 11 Apr 2013 13:23:47 +0000 Subject: indentation and iemnet__chunk_print() svn path=/trunk/externals/iem/iemnet/; revision=17086 --- iemnet_data.c | 20 +++++++++++++++----- iemnet_data.h | 9 +++++++-- iemnet_receiver.c | 3 +-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/iemnet_data.c b/iemnet_data.c index bbd0f07..965a326 100644 --- a/iemnet_data.c +++ b/iemnet_data.c @@ -116,11 +116,21 @@ void iemnet__chunk_destroy(t_iemnet_chunk*c) { free(c); } + +void iemnet__chunk_print(t_iemnet_chunk*c) { + unsigned int i=0; + startpost("chunk[%p:%d]", c, c?c->size:0); + if(!c)return; + for(i=0; isize; i++) + startpost(" %d", c->data[i]); + endpost(); +} + t_iemnet_chunk* iemnet__chunk_create_empty(int size) { t_iemnet_chunk*result=(t_iemnet_chunk*)malloc(sizeof(t_iemnet_chunk)); if(result) { result->size=size; - result->data=(unsigned char*)malloc(sizeof(unsigned char)*size); + result->data=(unsigned char*)malloc(sizeof(unsigned char)*size); if(NULL == result->data) { result->size=0; @@ -145,7 +155,7 @@ t_iemnet_chunk* iemnet__chunk_create_data(int size, unsigned char*data) { return result; } -t_iemnet_chunk* iemnet__chunk_create_dataaddr(int size, +t_iemnet_chunk* iemnet__chunk_create_dataaddr(int size, unsigned char*data, struct sockaddr_in*addr) { t_iemnet_chunk*result=iemnet__chunk_create_data(size, data); @@ -279,7 +289,7 @@ int queue_push( /* pop a chunk from the queue - * if the queue is empty, this will block until + * if the queue is empty, this will block until * something has been pushed * OR the queue is "done" (in which case NULL is returned) */ @@ -329,7 +339,7 @@ t_iemnet_chunk* queue_pop_block( } /* pop a chunk from the queue * if the queue is empty, this will immediately return NULL - * (note that despite of the name this does block for synchronization) + * (note that despite of the name this does block for synchronization) */ t_iemnet_chunk* queue_pop_noblock( t_iemnet_queue* const _this @@ -399,7 +409,7 @@ void queue_finish(t_iemnet_queue* q) { void queue_destroy(t_iemnet_queue* q) { t_iemnet_chunk*c=NULL; - if(NULL==q) + if(NULL==q) return; DEBUG("queue destroy %x", q); diff --git a/iemnet_data.h b/iemnet_data.h index ee871d2..f9a043c 100644 --- a/iemnet_data.h +++ b/iemnet_data.h @@ -74,6 +74,11 @@ typedef struct _iemnet_chunk { */ void iemnet__chunk_destroy(t_iemnet_chunk*); +/** + * print a "chunk" to the pd-console + */ +void iemnet__chunk_print(t_iemnet_chunk*c); + /** * initialize a "chunk" (allocate memory,...) of fixed size * receiver address will be set to 0 @@ -121,7 +126,7 @@ t_iemnet_chunk*iemnet__chunk_create_chunk(t_iemnet_chunk*source); * convert a data chunk to a Pd-list of A_FLOATs * the destination list will eventually be resized if it is too small to hold the chunk * - * \param c the chunk to convert + * \param c the chunk to convert * \param dest the destination list * \return the destination list if all went well, else NULL */ @@ -147,7 +152,7 @@ int queue_push(t_iemnet_queue* const q, t_iemnet_chunk* const d); /** * \brief pop data from the FIFO (queue), blocking * - * pops data from the stack; + * pops data from the stack; * if the stack is empty, this function will block until data is pushed to the stack * if the queue is finalized, this function will return immediately with NULL * diff --git a/iemnet_receiver.c b/iemnet_receiver.c index cb10a37..9b4a330 100644 --- a/iemnet_receiver.c +++ b/iemnet_receiver.c @@ -37,7 +37,6 @@ #define INBUFSIZE 65536L /* was 4096: size of receiving data buffer */ - struct _iemnet_receiver { pthread_t sigthread, recthread; int sockfd; /* owned outside; you must call iemnet__receiver_destroy() before freeing socket yourself */ @@ -117,7 +116,7 @@ static void*iemnet__receiver_readthread(void*arg) { FD_SET(sockfd, &readset); for(i=0; irunning=1; + receiver->running=1; pthread_mutex_lock (&receiver->running_mtx); pthread_cond_signal (&receiver->running_cond); -- cgit v1.2.1