ext/iodine/fiobj_hash.c
/**
 * Allows the Hash to be used as a stack.
 *
 * If a pointer `key` is provided, it will receive ownership of the key
 * (remember to free).
 *
 * Returns FIOBJ_INVALID on error.
 *
 * Returns and object if successful (remember to free).
 */
Allows the Hash to be used as a stack.
If a pointer `key` is provided, it will receive ownership of the key
(remember to free).

Returns FIOBJ_INVALID on error.

Returns and object if successful (remember to free).
Allows the Hash to be used as a stack . If a pointer ` key ` is provided it will receive ownership of the key ( remember to free ) . Returns FIOBJ_INVALID on error . Returns and object if successful ( remember to free ) .
FIOBJ fiobj_hash_pop(FIOBJ hash, FIOBJ *key) {
  assert(hash && FIOBJ_TYPE_IS(hash, FIOBJ_T_HASH));
  FIOBJ old;
  if (fio_hash___count(&obj2hash(hash)->hash))
    return FIOBJ_INVALID;
  old = fiobj_dup(fio_hash___last(&obj2hash(hash)->hash).obj);
  if (key)
    *key = fiobj_dup(fio_hash___last(&obj2hash(hash)->hash).key);
  fio_hash___pop(&obj2hash(hash)->hash);
  return old;
}
FIOBJ fiobj_hash_pop ( FIOBJ hash , FIOBJ * key ) { assert ( hash && FIOBJ_TYPE_IS ( hash , FIOBJ_T_HASH ) ) ; FIOBJ old ; if ( fio_hash___count ( & obj2hash ( hash ) -> hash ) ) return FIOBJ_INVALID ; old = fiobj_dup ( fio_hash___last ( & obj2hash ( hash ) -> hash ) . obj ) ; if ( key ) * key = fiobj_dup ( fio_hash___last ( & obj2hash ( hash ) -> hash ) . key ) ; fio_hash___pop ( & obj2hash ( hash ) -> hash ) ; return old ; }
Allows the Hash to be used as a stack.
Allows the Hash to be used as a stack .