NO

Author Topic: lifofifo  (Read 11144 times)

czerny

  • Guest
lifofifo
« on: February 06, 2013, 06:32:25 PM »
I am a little bit in hurry!

I wrote code for a stack and a double linked list which I need for a actual project. It would be nice if anyone could test it. I don't have the time now to test it as I should.

czerny

::: old bugs removed, new bugs created :-)
::: more of them

« Last Edit: May 21, 2013, 11:38:43 PM by czerny »

czerny

  • Guest
Re: lifofifo
« Reply #1 on: May 16, 2013, 09:44:05 AM »
I see that there are 0 downloads. Was the last release sooo bad?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: lifofifo
« Reply #2 on: May 16, 2013, 10:18:53 AM »
I have already downloaded it time ago.
I had no time to test it, but formally they seems ok.
If you have uploaded a new version the download counter resets, and if you don't add a new post the update is not signaled as new post.
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide

czerny

  • Guest
Re: lifofifo
« Reply #3 on: May 16, 2013, 07:20:37 PM »
If you have uploaded a new version the download counter resets, and if you don't add a new post the update is not signaled as new post.
Ahhh! I didn't know that.

czerny

  • Guest
Re: lifofifo
« Reply #4 on: May 21, 2013, 11:41:34 PM »
This is a new version with a circular buffer for strings (CRing). ;D
A wide char version (WRing) will follow.
« Last Edit: May 22, 2013, 08:22:24 AM by czerny »

czerny

  • Guest
Re: lifofifo
« Reply #5 on: May 22, 2013, 08:30:45 AM »
I would like to have some more challanging test examples.
Any ideas?

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: lifofifo
« Reply #6 on: May 24, 2013, 12:35:52 AM »
A simple test case would be nice...

What is the difference between the Ring and the circular buffer?

You use CircBufWrite (but no CircBufRead), RingWrite and RingRead, each of them with a memcpy. In my implementation, there is something like CircBufferGetPointer, but the user has to decide how to write into the buffer. For example, GetCurrentDirectory(260, CircBufferGetPointer()). IMHO it avoids unnecessary copies...

czerny

  • Guest
Re: lifofifo
« Reply #7 on: May 24, 2013, 12:48:45 AM »
A simple test case would be nice...
Search for circbuf-tst.c
In my implementation, there is something like CircBufferGetPointer, but the user has to decide how to write into the buffer. For example, GetCurrentDirectory(260, CircBufferGetPointer()). IMHO it avoids unnecessary copies...
Code: [Select]
GetCurrentDirectory(260, CircBufWrite(Buffer, NULL, 260))

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: lifofifo
« Reply #8 on: May 24, 2013, 11:19:07 AM »
GetCurrentDirectory(260, CircBufWrite(Buffer, NULL, 260))

   void *p = &R->buffer[R->pos];
   if (data)
      memcpy(p, data, len);
   else
      memset(p, 0, len);


OK, I see.

czerny

  • Guest
Re: lifofifo
« Reply #9 on: May 24, 2013, 03:24:51 PM »
What is the difference between the Ring and the circular buffer?
Ring is a data structure which holds equal sized objects. They are written by a producer and read by a consumer who remove the objects. It is possible to detect, if the ring is full or empty. CircBuf is more a all purpose temporary memory, as discussed.
« Last Edit: May 24, 2013, 03:29:35 PM by czerny »

czerny

  • Guest
Re: lifofifo
« Reply #10 on: May 24, 2013, 03:37:37 PM »
It would be interesting for me to discuss such a ring in a multithreaded environment with different threads, producing/consuming objects.
Per example: What is the overhead of using  the C11 _Atomic qualifier.
« Last Edit: May 24, 2013, 04:34:48 PM by czerny »