Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /*
7 * A test to see if the macros PR_DELETE and PR_FREEIF are
8 * properly defined. (See Bugzilla bug #39110.)
9 */
11 #include "nspr.h"
13 #include <stdio.h>
14 #include <stdlib.h>
16 static void Noop(void) { }
18 static void Fail(void)
19 {
20 printf("FAIL\n");
21 exit(1);
22 }
24 int main(int argc, char **argv)
25 {
26 int foo = 1;
27 char *ptr = NULL;
29 /* this fails to compile with the old definition of PR_DELETE */
30 if (foo)
31 PR_DELETE(ptr);
32 else
33 Noop();
35 /* this nests incorrectly with the old definition of PR_FREEIF */
36 if (foo)
37 PR_FREEIF(ptr);
38 else
39 Fail();
41 printf("PASS\n");
42 return 0;
43 }