Skip to content

Instantly share code, notes, and snippets.

@kay
Created May 27, 2013 19:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kay/5658595 to your computer and use it in GitHub Desktop.
Save kay/5658595 to your computer and use it in GitHub Desktop.
tag_invalidate and tag_free
void tag_invalidate(memory_t * memory) {
TAG_TYPE * start = PTR_START_TAG(memory);
*start = TAG_INVALID_VALUE;
TAG_TYPE * end = PTR_END_TAG(memory);
*end = TAG_INVALID_VALUE;
}
bool tag_free(memory_t * memory) {
if (tag_underran(memory) || tag_overran(memory)) {
return false;
}
tag_invalidate(memory);
TAG_TYPE * start = PTR_START_TAG(memory);
free(start);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment