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

Definition at line 2444 of file dis_old.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().

2445 {
2446  register DIS_CMND *cmndp;
2447  register int ret_val = -1;
2448 
2449  DISABLE_AST
2450  if(!Cmnds_head)
2451  {
2452  Cmnds_head = (DIS_CMND *)malloc(sizeof(DIS_CMND));
2453  sll_init((SLL *) Cmnds_head);
2454  }
2455  if(*size == 0)
2456  {
2457  if( (cmndp = (DIS_CMND *) sll_get_head((SLL *) Cmnds_head)))
2458  {
2459  if(cmndp->size > 0)
2460  {
2461  *size = cmndp->size;
2462  *tag = cmndp->tag;
2463  ENABLE_AST
2464  return(-1);
2465  }
2466  }
2467  }
2468  if( (cmndp = (DIS_CMND *) sll_remove_head((SLL *) Cmnds_head)) )
2469  {
2470  if (*size >= cmndp->size)
2471  {
2472  *size = cmndp->size;
2473  ret_val = 1;
2474  }
2475  memcpy(buffer, cmndp->buffer, *size);
2476  *tag = cmndp->tag;
2477  free(cmndp);
2478  ENABLE_AST
2479  return(ret_val);
2480  }
2481  ENABLE_AST
2482  return(0);
2483 }
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
static DIS_CMND * Cmnds_head
Definition: dis_old.c:2424
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: