tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

reinit.c (893B)


      1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      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/. */
      5 
      6 /* This test verifies that NSPR can be cleaned up and reinitialized. */
      7 
      8 #include "nspr.h"
      9 #include <stdio.h>
     10 
     11 int main() {
     12  PRStatus rv;
     13 
     14  fprintf(stderr, "Init 1\n");
     15  PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
     16  fprintf(stderr, "Cleanup 1\n");
     17  rv = PR_Cleanup();
     18  if (rv != PR_SUCCESS) {
     19    fprintf(stderr, "FAIL\n");
     20    return 1;
     21  }
     22 
     23  fprintf(stderr, "Init 2\n");
     24  PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
     25  fprintf(stderr, "Cleanup 2\n");
     26  rv = PR_Cleanup();
     27  if (rv != PR_SUCCESS) {
     28    fprintf(stderr, "FAIL\n");
     29    return 1;
     30  }
     31 
     32  fprintf(stderr, "PASS\n");
     33  return 0;
     34 }