errstrs.c 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "prerror.h"
  5. #include "secerr.h"
  6. #include "secport.h"
  7. #include "prinit.h"
  8. #include "prprf.h"
  9. #include "prtypes.h"
  10. #include "prlog.h"
  11. #include "plstr.h"
  12. #include "nssutil.h"
  13. #include <string.h>
  14. #define ER3(name, value, str) { #name, str },
  15. static const struct PRErrorMessage sectext[] = {
  16. #include "SECerrs.h"
  17. { 0, 0 }
  18. };
  19. static const struct PRErrorTable sec_et = {
  20. sectext, "secerrstrings", SEC_ERROR_BASE,
  21. (sizeof sectext) / (sizeof sectext[0])
  22. };
  23. static PRStatus
  24. nss_InitializePRErrorTableOnce(void)
  25. {
  26. return PR_ErrorInstallTable(&sec_et);
  27. }
  28. static PRCallOnceType once;
  29. SECStatus
  30. NSS_InitializePRErrorTable(void)
  31. {
  32. return (PR_SUCCESS == PR_CallOnce(&once, nss_InitializePRErrorTableOnce))
  33. ? SECSuccess
  34. : SECFailure;
  35. }