| OLD | NEW |
| 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 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 | 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 | 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/. */ | 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 5 | 5 |
| 6 #include "primpl.h" | 6 #include "primpl.h" |
| 7 | 7 |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #ifdef XP_BEOS | 10 #ifdef XP_BEOS |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 /* | 953 /* |
| 954 ** Unload a shared library which was loaded via PR_LoadLibrary | 954 ** Unload a shared library which was loaded via PR_LoadLibrary |
| 955 */ | 955 */ |
| 956 PR_IMPLEMENT(PRStatus) | 956 PR_IMPLEMENT(PRStatus) |
| 957 PR_UnloadLibrary(PRLibrary *lib) | 957 PR_UnloadLibrary(PRLibrary *lib) |
| 958 { | 958 { |
| 959 int result = 0; | 959 int result = 0; |
| 960 PRStatus status = PR_SUCCESS; | 960 PRStatus status = PR_SUCCESS; |
| 961 | 961 |
| 962 if ((lib == 0) || (lib->refCount <= 0)) { | 962 if (lib == 0) { |
| 963 PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); | 963 PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); |
| 964 return PR_FAILURE; | 964 return PR_FAILURE; |
| 965 } | 965 } |
| 966 | 966 |
| 967 PR_EnterMonitor(pr_linker_lock); | 967 PR_EnterMonitor(pr_linker_lock); |
| 968 |
| 969 if (lib->refCount <= 0) { |
| 970 PR_ExitMonitor(pr_linker_lock); |
| 971 PR_SetError(PR_INVALID_ARGUMENT_ERROR, 0); |
| 972 return PR_FAILURE; |
| 973 } |
| 974 |
| 968 if (--lib->refCount > 0) { | 975 if (--lib->refCount > 0) { |
| 969 PR_LOG(_pr_linker_lm, PR_LOG_MIN, | 976 PR_LOG(_pr_linker_lm, PR_LOG_MIN, |
| 970 ("%s decr => %d", | 977 ("%s decr => %d", |
| 971 lib->name, lib->refCount)); | 978 lib->name, lib->refCount)); |
| 972 goto done; | 979 goto done; |
| 973 } | 980 } |
| 974 | 981 |
| 975 #ifdef XP_BEOS | 982 #ifdef XP_BEOS |
| 976 if(((image_id)lib->stub_dlh) == B_ERROR) | 983 if(((image_id)lib->stub_dlh) == B_ERROR) |
| 977 unload_add_on( (image_id) lib->dlh ); | 984 unload_add_on( (image_id) lib->dlh ); |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1592 result = PR_Malloc(strlen(module_name)+1); | 1599 result = PR_Malloc(strlen(module_name)+1); |
| 1593 if (result != NULL) { | 1600 if (result != NULL) { |
| 1594 strcpy(result, module_name); | 1601 strcpy(result, module_name); |
| 1595 } | 1602 } |
| 1596 return result; | 1603 return result; |
| 1597 #else | 1604 #else |
| 1598 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); | 1605 PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0); |
| 1599 return NULL; | 1606 return NULL; |
| 1600 #endif | 1607 #endif |
| 1601 } | 1608 } |
| OLD | NEW |