src/dbs/atrshmlogreaderd_db.c
int init_buffers(int i_count)
{
  mb_t * m = malloc(i_count * sizeof(mb_t));

  if (m)
    {
      char* buffers = malloc(i_count * MB_INFOSIZE);
       
      if (buffers)
	{
	  mb_t* mb = m;
	   
	  for (int i = 0; i  < i_count; i++, mb++, buffers += MB_INFOSIZE)
	    {
	      mb->next = &mb[1]; 
	      mb->next_append = &mb[1];
	      mb->next_full = 0;
	      mb->lcount = 0;
	      mb->ob = buffers;
	    }

	  /* we correct the last buffer */
	  mb--;
	  mb->next = 0;
	  mb->next_append = 0;
	  
	  atomic_store(&tps, (intptr_t)m);
	  atomic_store(&tpa, (intptr_t)m);
	   
	  return 0;
	}
    }
  
  return -1;
}
/**
 * we get the buffers in the list
 */
we get the buffers in the list
we get the buffers in the list
int init_buffers(int i_count)
{
  mb_t * m = malloc(i_count * sizeof(mb_t));
  if (m)
    {
      char* buffers = malloc(i_count * MB_INFOSIZE);
      if (buffers)
	{
	  mb_t* mb = m;
	  for (int i = 0; i  < i_count; i++, mb++, buffers += MB_INFOSIZE)
	    {
	      mb->next = &mb[1]; 
	      mb->next_append = &mb[1];
	      mb->next_full = 0;
	      mb->lcount = 0;
	      mb->ob = buffers;
	    }
	  mb--;
	  mb->next = 0;
	  mb->next_append = 0;
	  atomic_store(&tps, (intptr_t)m);
	  atomic_store(&tpa, (intptr_t)m);
	  return 0;
	}
    }
  return -1;
}
int init_buffers ( int i_count ) { mb_t * m = malloc ( i_count * sizeof ( mb_t ) ) ; if ( m ) { char * buffers = malloc ( i_count * MB_INFOSIZE ) ; if ( buffers ) { mb_t * mb = m ; for ( int i = 0 ; i < i_count ; i ++ , mb ++ , buffers += MB_INFOSIZE ) { mb -> next = & mb [ 1 ] ; mb -> next_append = & mb [ 1 ] ; mb -> next_full = 0 ; mb -> lcount = 0 ; mb -> ob = buffers ; } mb -- ; mb -> next = 0 ; mb -> next_append = 0 ; atomic_store ( & tps , ( intptr_t ) m ) ; atomic_store ( & tpa , ( intptr_t ) m ) ; return 0 ; } } return -1 ; }
we get the buffers in the list
we get the buffers in the list
/* we correct the last buffer */