BurstFS_Client/src/cruise-stack.c
int cruise_stack_pop(void* start)
{
  cruise_stack* stack = (cruise_stack*) start;

  /* check that the stack isn't empty */
  if (stack->last > 0) {
    /* decrement the last pointer by one */
    stack->last--;
	
    /* return the index into entries array,
     * this now points to item at top of stack */
    int idx = stack->last;

    /* return the value of this item */
    int* entries = (int*) ((char*)start + sizeof(cruise_stack));
    int value = entries[idx];
    return value;
  } else {
    /* out of space */
    return -1;
  }
}
/* pops one entry from stack and returns its value */
pops one entry from stack and returns its value
pops one entry from stack and returns its value
int cruise_stack_pop(void* start)
{
  cruise_stack* stack = (cruise_stack*) start;
  if (stack->last > 0) {
    stack->last--;
    int idx = stack->last;
    int* entries = (int*) ((char*)start + sizeof(cruise_stack));
    int value = entries[idx];
    return value;
  } else {
    return -1;
  }
}
int cruise_stack_pop ( void * start ) { cruise_stack * stack = ( cruise_stack * ) start ; if ( stack -> last > 0 ) { stack -> last -- ; int idx = stack -> last ; int * entries = ( int * ) ( ( char * ) start + sizeof ( cruise_stack ) ) ; int value = entries [ idx ] ; return value ; } else { return -1 ; } }
pops one entry from stack and returns its value
pops one entry from stack and returns its value
/* check that the stack isn't empty */ /* decrement the last pointer by one */ /* return the index into entries array,
     * this now points to item at top of stack */ /* return the value of this item */ /* out of space */