FACT++  1.0
int dis_get_next_cmnd ( dim_long tag,
int *  buffer,
int *  size 
)

Definition at line 2754 of file dis.c.

References cmnds::buffer, Memory::free(), Memory::malloc(), cmnds::size, sll_get_head(), sll_init(), sll_remove_head(), and cmnds::tag.

Referenced by dis_hash_print().

2755 {
2756  register DIS_CMND *cmndp;
2757  register int ret_val = -1;
2758 
2759  DISABLE_AST
2760  if(!Cmnds_head)
2761  {
2762  Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
2763  sll_init((SLL *) Cmnds_head);
2764  }
2765  if(*size == 0)
2766  {
2767  if( (cmndp = (DIS_CMND *) sll_get_head((SLL *) Cmnds_head)))
2768  {
2769  if(cmndp->size > 0)
2770  {
2771  *size = cmndp->size;
2772  *tag = cmndp->tag;
2773  ENABLE_AST
2774  return(-1);
2775  }
2776  }
2777  }
2778  if( (cmndp = (DIS_CMND *) sll_remove_head((SLL *) Cmnds_head)) )
2779  {
2780  if (*size >= cmndp->size)
2781  {
2782  *size = cmndp->size;
2783  ret_val = 1;
2784  }
2785  memcpy(buffer, cmndp->buffer, (size_t)*size);
2786  *tag = cmndp->tag;
2787  free(cmndp);
2788  ENABLE_AST
2789  return(ret_val);
2790  }
2791  ENABLE_AST
2792  return(0);
2793 }
static DIS_CMND * Cmnds_head
Definition: dis.c:2734
SLL * sll_get_head(SLL *head)
Definition: sll.c:107
int buffer[1]
Definition: dis.c:2731
void * malloc()
Definition: EventBuilder.cc:99
Definition: dis.c:2727
Definition: dim.h:536
SLL * sll_remove_head(SLL *head)
Definition: sll.c:94
void sll_init(SLL *head)
Definition: sll.c:14
dim_long tag
Definition: dis.c:2729
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
int size
Definition: db_dim_server.c:17
void free(void *mem)
int size
Definition: dis.c:2730

+ Here is the call graph for this function:

+ Here is the caller graph for this function: