Exemplo n.º 1
0
void pool_free(pool_t *pool, void *ptr) {
  if (ptr) {
    PL_ArenaRelease((PLArenaPool*)pool, ptr);
  }
}
Exemplo n.º 2
0
/* # 651 "arena.c" */
static PRStatus
nss_arena_unmark_release
(
  NSSArena *arena,
  nssArenaMark *arenaMark,
  PRBool release
)
{
  void *inner_mark;







  if( 0x4d41524b != arenaMark->magic ) {
    nss_SetError(NSS_ERROR_INVALID_ARENA_MARK);
    return PR_FAILURE;
  }

  if( (PRLock *)((void *)0) == arena->lock ) {

    nss_SetError(NSS_ERROR_INVALID_ARENA);
    return PR_FAILURE;
  }
  PR_Lock(arena->lock);
/* # 689 "arena.c" */
  if( 0x4d41524b != arenaMark->magic ) {

    PR_Unlock(arena->lock);
    nss_SetError(NSS_ERROR_INVALID_ARENA_MARK);
    return PR_FAILURE;
  }

  arenaMark->magic = 0;
  inner_mark = arenaMark->mark;
/* # 729 "arena.c" */
  if( release ) {
/* # 740 "arena.c" */
    do { char *_m = (char *)(inner_mark); PLArena *_a = (&arena->pool)->current; if (((PRUword)(_m) - (PRUword)(_a->base)) <= ((PRUword)(_a->avail) - (PRUword)(_a->base))) { _a->avail = (PRUword)(((PRUword)(_m) + (&arena->pool)->mask) & ~(&arena->pool)->mask); ; ; } else { PL_ArenaRelease(&arena->pool, _m); } ; } while (0);

  }

  PR_Unlock(arena->lock);
  return PR_SUCCESS;
}