Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: nss/lib/libpkix/pkix/util/pkix_errpaths.c

Issue 2078763002: Delete bundled copy of NSS and replace with README. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/nss@master
Patch Set: Delete bundled copy of NSS and replace with README. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « nss/lib/libpkix/pkix/util/pkix_error.c ('k') | nss/lib/libpkix/pkix/util/pkix_list.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 /*
5 * pkix_errpaths.c
6 *
7 * Error Handling Helper Functions
8 *
9 */
10
11 #define PKIX_STDVARS_POINTER
12 #include "pkix_error.h"
13
14 const PKIX_StdVars zeroStdVars;
15
16 PKIX_Error*
17 PKIX_DoThrow(PKIX_StdVars * stdVars, PKIX_ERRORCLASS errClass,
18 PKIX_ERRORCODE errCode, PKIX_ERRORCLASS overrideClass,
19 void *plContext)
20 {
21 if (!pkixErrorReceived && !pkixErrorResult && pkixErrorList) {
22 pkixTempResult = PKIX_List_GetItem(pkixErrorList, 0,
23 (PKIX_PL_Object**)&pkixReturnResult,
24 plContext);
25 } else {
26 pkixTempResult = (PKIX_Error*)pkix_Throw(errClass, myFuncName, errCode,
27 overrideClass, pkixErrorResult,
28 &pkixReturnResult, plContext);
29 }
30 if (pkixReturnResult) {
31 if (pkixErrorResult != PKIX_ALLOC_ERROR()) {
32 PKIX_DECREF(pkixErrorResult);
33 }
34 pkixTempResult = pkixReturnResult;
35 } else if (pkixErrorResult) {
36 if (pkixTempResult != PKIX_ALLOC_ERROR()) {
37 PKIX_DECREF(pkixTempResult);
38 }
39 pkixTempResult = pkixErrorResult;
40 }
41 if (pkixErrorList) {
42 PKIX_PL_Object_DecRef((PKIX_PL_Object*)pkixErrorList, plContext);
43 pkixErrorList = NULL;
44 }
45 return pkixTempResult;
46 }
47
48 PKIX_Error *
49 PKIX_DoReturn(PKIX_StdVars * stdVars, PKIX_ERRORCLASS errClass,
50 PKIX_Boolean doLogger, void *plContext)
51 {
52 PKIX_OBJECT_UNLOCK(lockedObject);
53 if (pkixErrorReceived || pkixErrorResult || pkixErrorList)
54 return PKIX_DoThrow(stdVars, errClass, pkixErrorCode, pkixErrorClass,
55 plContext);
56 /* PKIX_DEBUG_EXIT(type); */
57 if (doLogger)
58 _PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, "<<<", PKIX_LOGGER_LEVEL_TRACE) ;
59 return NULL;
60 }
61
62 /* PKIX_DoAddError - creates the list of received error if it does not exist
63 * yet and adds newly received error into the list. */
64 void
65 PKIX_DoAddError(PKIX_StdVars *stdVars, PKIX_Error *error, void * plContext)
66 {
67 PKIX_List *localList = NULL;
68 PKIX_Error *localError = NULL;
69 PKIX_Boolean listCreated = PKIX_FALSE;
70
71 if (!pkixErrorList) {
72 localError = PKIX_List_Create(&localList, plContext);
73 if (localError)
74 goto cleanup;
75 listCreated = PKIX_TRUE;
76 } else {
77 localList = pkixErrorList;
78 }
79
80 localError = PKIX_List_AppendItem(localList, (PKIX_PL_Object*)error,
81 plContext);
82 PORT_Assert (localError == NULL);
83 if (localError != NULL) {
84 if (listCreated) {
85 /* ignore the error code of DecRef function */
86 PKIX_PL_Object_DecRef((PKIX_PL_Object*)localList, plContext);
87 localList = NULL;
88 }
89 } else {
90 pkixErrorList = localList;
91 }
92
93 cleanup:
94
95 if (localError && localError != PKIX_ALLOC_ERROR()) {
96 PKIX_PL_Object_DecRef((PKIX_PL_Object*)localError, plContext);
97 }
98
99 if (error && error != PKIX_ALLOC_ERROR()) {
100 PKIX_PL_Object_DecRef((PKIX_PL_Object*)error, plContext);
101 }
102 }
103
OLDNEW
« no previous file with comments | « nss/lib/libpkix/pkix/util/pkix_error.c ('k') | nss/lib/libpkix/pkix/util/pkix_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698