int ratt_table_del_current(ratt_table_t *table) { RATTLOG_TRACE(); void *chunk = NULL; chunk = ratt_table_current(table); if (!chunk) { debug("ratt_table_current() failed"); return FAIL; } else if (is_frag(table->frag_mask, table->pos)) { debug("chunk at %p already freed", chunk); return FAIL; } debug("deleting chunk at %p", chunk); memset(chunk, 0, table->chunk_size); table->chunk_count--; /* if chunk is the tail, move the tail back */ if (ratt_table_istail(table, chunk) && !ratt_table_ishead(table, chunk)) { table->tail = (char *) chunk - table->chunk_size; table->pos = --table->last; debug("moved tail back to %p", table->tail); } else /* handle fragmentation */ frag_mask_set(table->frag_mask, table->pos, &(table->frag_count)); return OK; }
static ActionSkBuff filter_no_frag(arguments_t args, SkBuff b) { return is_frag(b) ? Drop(b) : Pass(b); }
static bool pred_is_frag(arguments_t args, SkBuff b) { return is_frag(b); }