Skip to content

Commit

Permalink
pointer-revocation: Fix #if and use #ifdef
Browse files Browse the repository at this point in the history
Using just #if VAR is wrong, at least for ours, and the style elsewhere
is to use #ifdef rather than #if defined whenever possible.
  • Loading branch information
jrtc27 committed Sep 9, 2020
1 parent 5bb0654 commit ff95344
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/exercises/pointer-revocation/temporal-control.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>

/* Ensure we're being run on a temporal-safety-aware system */
#if __CHERI_PURE_CAPABILITY__
#ifdef __CHERI_PURE_CAPABILITY__
#include <sys/caprevoke.h>
__attribute__((used))
static void *check_caprevoke = caprevoke;
Expand Down Expand Up @@ -51,13 +51,13 @@ main(void)
fprintf(stderr, "Demonstrating use after free:\n");
obj1->fn(obj1->arg);

#if defined(CAPREVOKE)
#ifdef CAPREVOKE
/* Force recycling the free queue now, but with a revocation pass */
malloc_revoke();
#endif

struct obj *obj2 = malloc(sizeof(*obj2));
#if defined(CAPREVOKE)
#ifdef CAPREVOKE
assert(obj1 == obj2);
#endif

Expand Down

0 comments on commit ff95344

Please sign in to comment.