Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * A test to see if the macros PR_DELETE and PR_FREEIF are |
michael@0 | 8 | * properly defined. (See Bugzilla bug #39110.) |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #include "nspr.h" |
michael@0 | 12 | |
michael@0 | 13 | #include <stdio.h> |
michael@0 | 14 | #include <stdlib.h> |
michael@0 | 15 | |
michael@0 | 16 | static void Noop(void) { } |
michael@0 | 17 | |
michael@0 | 18 | static void Fail(void) |
michael@0 | 19 | { |
michael@0 | 20 | printf("FAIL\n"); |
michael@0 | 21 | exit(1); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | int main(int argc, char **argv) |
michael@0 | 25 | { |
michael@0 | 26 | int foo = 1; |
michael@0 | 27 | char *ptr = NULL; |
michael@0 | 28 | |
michael@0 | 29 | /* this fails to compile with the old definition of PR_DELETE */ |
michael@0 | 30 | if (foo) |
michael@0 | 31 | PR_DELETE(ptr); |
michael@0 | 32 | else |
michael@0 | 33 | Noop(); |
michael@0 | 34 | |
michael@0 | 35 | /* this nests incorrectly with the old definition of PR_FREEIF */ |
michael@0 | 36 | if (foo) |
michael@0 | 37 | PR_FREEIF(ptr); |
michael@0 | 38 | else |
michael@0 | 39 | Fail(); |
michael@0 | 40 | |
michael@0 | 41 | printf("PASS\n"); |
michael@0 | 42 | return 0; |
michael@0 | 43 | } |