diff --git a/mozilla/xpcom/base/nscore.h b/mozilla/xpcom/base/nscore.h index 4fe9107a375..d463b2cf471 100644 --- a/mozilla/xpcom/base/nscore.h +++ b/mozilla/xpcom/base/nscore.h @@ -242,9 +242,18 @@ #endif #ifdef MOZILLA_INTERNAL_API -#define NS_COM_GLUE NS_COM +# define NS_COM_GLUE NS_COM + /* + The frozen string API has different definitions of nsAC?String + classes than the internal API. On systems that explicitly declare + dllexport symbols this is not a problem, but on ELF systems + internal symbols can accidentally "shine through"; we rename the + internal classes to avoid symbol conflicts. + */ +# define nsAString nsAString_internal +# define nsACString nsACString_internal #else -#define NS_COM_GLUE +# define NS_COM_GLUE #endif diff --git a/mozilla/xpcom/build/Makefile.in b/mozilla/xpcom/build/Makefile.in index 0fdead1f641..9b48ae4ac54 100644 --- a/mozilla/xpcom/build/Makefile.in +++ b/mozilla/xpcom/build/Makefile.in @@ -75,6 +75,7 @@ endif CPPSRCS = \ $(XPCOM_GLUE_SRC_LCSRCS) \ + $(XPCOM_GLUENS_SRC_LCSRCS) \ nsXPComInit.cpp \ nsStringAPI.cpp \ $(NULL) @@ -144,7 +145,7 @@ endif # UNIX98 iconv support OS_LIBS += $(LIBICONV) -GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX)) +GARBAGE += $(XPCOM_GLUE_SRC_LCSRCS) $(XPCOM_GLUENS_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX)) include $(topsrcdir)/config/rules.mk @@ -177,5 +178,5 @@ EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME,imagehlp) endif endif # WINNT -export:: $(XPCOM_GLUE_SRC_CSRCS) +export:: $(XPCOM_GLUE_SRC_CSRCS) $(XPCOM_GLUENS_SRC_CSRCS) $(INSTALL) $^ . diff --git a/mozilla/xpcom/glue/Makefile.in b/mozilla/xpcom/glue/Makefile.in index 4135d985065..523841ff351 100644 --- a/mozilla/xpcom/glue/Makefile.in +++ b/mozilla/xpcom/glue/Makefile.in @@ -58,6 +58,7 @@ LOCAL_INCLUDES = \ CPPSRCS = \ $(XPCOM_GLUE_SRC_LCSRCS) \ + $(XPCOM_GLUENS_SRC_LCSRCS) \ $(NULL) SDK_HEADERS = \ diff --git a/mozilla/xpcom/glue/nsDebug.h b/mozilla/xpcom/glue/nsDebug.h index 89c81442fc1..6e4d0811c5e 100644 --- a/mozilla/xpcom/glue/nsDebug.h +++ b/mozilla/xpcom/glue/nsDebug.h @@ -270,7 +270,11 @@ public: /////////////////////////////////////////////////////////////////////////////// +#ifdef XPCOM_GLUE +#define NS_CheckThreadSafe +#else #define NS_CheckThreadSafe(owningThread, msg) \ NS_ASSERTION(owningThread == PR_GetCurrentThread(), msg) +#endif #endif /* nsDebug_h___ */ diff --git a/mozilla/xpcom/glue/nsGREGlue.cpp b/mozilla/xpcom/glue/nsGREGlue.cpp index de6e2333bcc..24468f06da4 100755 --- a/mozilla/xpcom/glue/nsGREGlue.cpp +++ b/mozilla/xpcom/glue/nsGREGlue.cpp @@ -44,10 +44,6 @@ #include #include -#include "prenv.h" -#include "prio.h" -#include "plstr.h" - #ifdef XP_WIN32 # include # include @@ -63,6 +59,7 @@ #elif defined(XP_UNIX) # include # include +# include #elif defined(XP_BEOS) # include # include @@ -103,7 +100,7 @@ GRE_GetGREPathForVersion(const char *aVersion, char *aBuffer, PRUint32 aBufLen) { // if GRE_HOME is in the environment, use that GRE - const char* env = PR_GetEnv("GRE_HOME"); + const char* env = getenv("GRE_HOME"); if (env && *env) { #if XP_UNIX if (realpath(env, aBuffer)) @@ -125,7 +122,7 @@ GRE_GetGREPathForVersion(const char *aVersion, } // the Gecko bits that sit next to the application or in the LD_LIBRARY_PATH - env = PR_GetEnv("USE_LOCAL_GRE"); + env = getenv("USE_LOCAL_GRE"); if (env && *env) { *aBuffer = nsnull; return NS_OK; @@ -167,7 +164,7 @@ GRE_GetGREPathForVersion(const char *aVersion, return NS_OK; // Check ~/Library/Frameworks/XUL/Versions//libxpcom.dylib - const char *home = PR_GetEnv("HOME"); + const char *home = getenv("HOME"); if (home && *home && GRE_FindGREFramework(aVersion, home, aBuffer, aBufLen)) { return NS_OK; } @@ -177,13 +174,13 @@ GRE_GetGREPathForVersion(const char *aVersion, return NS_OK; } -#elif defined(XP_UNIX) - env = PR_GetEnv("MOZ_GRE_CONF"); +#elif defined(XP_UNIX) + env = getenv("MOZ_GRE_CONF"); if (env && GRE_GetPathFromConfigFile(aVersion, env, aBuffer, aBufLen)) { return NS_OK; } - env = PR_GetEnv("HOME"); + env = getenv("HOME"); if (env && *env) { char buffer[MAXPATHLEN]; @@ -270,6 +267,13 @@ GRE_FindGREFramework(const char* version, const char* rootPath, #elif defined(XP_UNIX) +static PRBool IsConfFile(const char *filename) +{ + const char *dot = strrchr(filename, '.'); + + return (dot && strcmp(dot, ".conf") == 0); +} + PRBool GRE_GetPathFromConfigDir(const char* version, const char* dirname, char* buffer, PRUint32 buflen) @@ -277,33 +281,28 @@ GRE_GetPathFromConfigDir(const char* version, const char* dirname, // Open the directory provided and try to read any files in that // directory that end with .conf. We look for an entry that might // point to the GRE that we're interested in. - PRDir *dir = PR_OpenDir(dirname); + DIR *dir = opendir(dirname); if (!dir) return nsnull; PRBool found = PR_FALSE; - PRDirEntry *entry; + struct dirent *entry; - while (!found && (entry = PR_ReadDir(dir, PR_SKIP_BOTH))) { - - static const char kExt[] = ".conf"; + while (!found && (entry = readdir(dir))) { // Only look for files that end in .conf - char *offset = PL_strrstr(entry->name, kExt); - if (!offset) - continue; - - if (offset != entry->name + strlen(entry->name) - (sizeof(kExt) - 1)) + // IsConfFile will skip "." and ".." + if (!IsConfFile(entry->d_name)) continue; char fullPath[MAXPATHLEN]; snprintf(fullPath, sizeof(fullPath), "%s" XPCOM_FILE_PATH_SEPARATOR "%s", - dirname, entry->name); + dirname, entry->d_name); found = GRE_GetPathFromConfigFile(version, fullPath, buffer, buflen); } - PR_CloseDir(dir); + closedir(dir); return found; } diff --git a/mozilla/xpcom/glue/nsGenericFactory.cpp b/mozilla/xpcom/glue/nsGenericFactory.cpp index fa814db6d7f..2e7633afb07 100644 --- a/mozilla/xpcom/glue/nsGenericFactory.cpp +++ b/mozilla/xpcom/glue/nsGenericFactory.cpp @@ -382,14 +382,6 @@ nsGenericModule::GetClassObject(nsIComponentManager *aCompMgr, desc++; } // not found in descriptions -#ifndef XPCOM_GLUE -#ifdef DEBUG - char* cs = aClass.ToString(); - fprintf(stderr, "+++ nsGenericModule %s: unable to create factory for %s\n", mModuleName, cs); - // leak until we resolve the nsID Allocator. - // nsCRT::free(cs); -#endif // XXX put in stop-gap so that we don't search for this one again -#endif return NS_ERROR_FACTORY_NOT_REGISTERED; } diff --git a/mozilla/xpcom/glue/nsISupportsImpl.h b/mozilla/xpcom/glue/nsISupportsImpl.h index a7b24537bdb..4bc22a1a515 100644 --- a/mozilla/xpcom/glue/nsISupportsImpl.h +++ b/mozilla/xpcom/glue/nsISupportsImpl.h @@ -45,8 +45,13 @@ #include "nsISupportsBase.h" #endif +#ifndef XPCOM_GLUE +// If we're being linked as standalone glue, we don't want a dynamic dependency +// on NSPR libs, so we skip the debug thread-safety checks. + #include "prthread.h" /* needed for thread-safety checks */ #include "pratom.h" /* needed for PR_AtomicIncrement and PR_AtomicDecrement */ +#endif #include "nsDebug.h" #include "nsTraceRefcnt.h" @@ -54,7 +59,7 @@ //////////////////////////////////////////////////////////////////////////////// // Macros to help detect thread-safety: -#if defined(NS_DEBUG) +#if defined(NS_DEBUG) && !defined(XPCOM_GLUE) class nsAutoOwningThread { public: @@ -69,7 +74,7 @@ private: #define NS_ASSERT_OWNINGTHREAD(_class) \ NS_CheckThreadSafe(_mOwningThread.GetThread(), #_class " not thread-safe") -#else // !(defined(NS_DEBUG)) +#else // !(defined(NS_DEBUG) && !defined(XPCOM_GLUE)) #define NS_DECL_OWNINGTHREAD /* nothing */ #define NS_ASSERT_OWNINGTHREAD(_class) ((void)0) @@ -675,10 +680,14 @@ NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ /////////////////////////////////////////////////////////////////////////////// /** * - * Threadsafe implementations of the ISupports convenience macros + * Threadsafe implementations of the ISupports convenience macros. * + * @note These are not available when linking against the standalone glue, + * because the implementation requires PR_ symbols. */ +#ifndef XPCOM_GLUE + /** * Use this macro to implement the AddRef method for a given _class * @param _class The name of the class implementing the method @@ -716,6 +725,15 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ return count; \ } +#else // XPCOM_GLUE +#define NS_IMPL_THREADSAFE_ADDREF(_class) \ + THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; + +#define NS_IMPL_THREADSAFE_RELEASE(_class) \ + THREADSAFE_ISUPPORTS_NOT_AVAILABLE_IN_STANDALONE_GLUE; + +#endif // XPCOM_GLUE + #define NS_IMPL_THREADSAFE_ISUPPORTS0(_class) \ NS_IMPL_THREADSAFE_ADDREF(_class) \ NS_IMPL_THREADSAFE_RELEASE(_class) \ diff --git a/mozilla/xpcom/glue/objs.mk b/mozilla/xpcom/glue/objs.mk index b3cfd05650e..68915eca1db 100644 --- a/mozilla/xpcom/glue/objs.mk +++ b/mozilla/xpcom/glue/objs.mk @@ -38,12 +38,21 @@ XPCOM_GLUE_SRC_LCSRCS = \ nsCOMPtr.cpp \ nsComponentManagerUtils.cpp \ nsDebug.cpp \ - nsGenericFactory.cpp \ nsIInterfaceRequestorUtils.cpp \ nsMemory.cpp \ nsTraceRefcnt.cpp \ nsWeakReference.cpp \ nsGREGlue.cpp \ - $(NULL) \ + $(NULL) XPCOM_GLUE_SRC_CSRCS := $(addprefix $(topsrcdir)/xpcom/glue/, $(XPCOM_GLUE_SRC_LCSRCS)) + +# nsGenericFactory is not really all that helpful in the standalone glue, +# and it has a bad dependency on the NSPR AtomicIncrement function, so we +# only build it for the dependent XPCOM glue and builtin to xpcom-core. + +XPCOM_GLUENS_SRC_LCSRCS = \ + nsGenericFactory.cpp \ + $(NULL) + +XPCOM_GLUENS_SRC_CSRCS := $(addprefix $(topsrcdir)/xpcom/glue/,$(XPCOM_GLUENS_SRC_LCSRCS)) diff --git a/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp b/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp index a97f2755e3b..39e56455456 100644 --- a/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp +++ b/mozilla/xpcom/glue/standalone/nsGREDirServiceProvider.cpp @@ -182,13 +182,13 @@ GRE_GetCurrentProcessDirectory(char* buffer) // We do this py putenv()ing the default value into the environment. Note that // we only do this if it is not already set. #ifdef MOZ_DEFAULT_MOZILLA_FIVE_HOME - if (PR_GetEnv("MOZILLA_FIVE_HOME") == nsnull) + if (getenv("MOZILLA_FIVE_HOME") == nsnull) { putenv("MOZILLA_FIVE_HOME=" MOZ_DEFAULT_MOZILLA_FIVE_HOME); } #endif - char *moz5 = PR_GetEnv("MOZILLA_FIVE_HOME"); + char *moz5 = getenv("MOZILLA_FIVE_HOME"); if (moz5 && *moz5) { @@ -332,7 +332,7 @@ GRE_GetXPCOMPath() const char* grePath = GRE_GetGREPath(); if (!grePath) { - grePath = PR_GetEnv("MOZILLA_FIVE_HOME"); + grePath = getenv("MOZILLA_FIVE_HOME"); if (!grePath || !*grePath) { return nsnull; } diff --git a/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp b/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp index 1307ac96760..4ea39904200 100644 --- a/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp +++ b/mozilla/xpcom/glue/standalone/nsXPCOMGlue.cpp @@ -55,8 +55,6 @@ #include #endif -void GRE_AddGREToEnvironment(); - // functions provided by nsDebug.cpp nsresult GlueStartupDebug(); void GlueShutdownDebug(); @@ -111,7 +109,6 @@ nsresult XPCOMGlueStartup(const char* xpcomFile) return rv; } - GRE_AddGREToEnvironment(); return NS_OK; #else // @@ -192,7 +189,6 @@ nsresult XPCOMGlueStartup(const char* xpcomFile) if (NS_FAILED(rv)) goto bail; - GRE_AddGREToEnvironment(); return NS_OK; bail: @@ -518,53 +514,6 @@ NS_Free(void* ptr) xpcomFunctions.freeFunc(ptr); } -static char* spEnvString = 0; - -void -GRE_AddGREToEnvironment() -{ -#ifdef WINCE - return; -#else - - const char* grePath = GRE_GetGREPath(); - if (!grePath) - return; - - const char* path = PR_GetEnv(XPCOM_SEARCH_KEY); - if (!path) { - path = ""; - } - - /** - * This buffer will leak at shutdown due to a restriction in PR_SetEnv - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=25982#c3 - * See-Also: http://lxr.mozilla.org/mozilla/source/nsprpub/pr/include/prenv.h - */ - char * tempPath = PR_smprintf(XPCOM_SEARCH_KEY "=%s" XPCOM_ENV_PATH_SEPARATOR "%s", - grePath, path); - if (tempPath){ - if (PR_SetEnv(tempPath) == PR_SUCCESS){ - if (spEnvString) PR_smprintf_free(spEnvString); - spEnvString = tempPath; - }else - PR_smprintf_free(tempPath); - } - -#ifdef XP_WIN32 - // On windows, the current directory is searched before the - // PATH environment variable. This is a very bad thing - // since libraries in the cwd will be picked up before - // any that are in either the application or GRE directory. - - if (grePath) { - SetCurrentDirectory(grePath); - } -#endif // XP_WIN32 -#endif // WINCE -} - - // Default GRE startup/shutdown code extern "C" diff --git a/mozilla/xpcom/sample/Makefile.in b/mozilla/xpcom/sample/Makefile.in index 09ec9523ecf..5c3e3953234 100644 --- a/mozilla/xpcom/sample/Makefile.in +++ b/mozilla/xpcom/sample/Makefile.in @@ -20,6 +20,7 @@ # the Initial Developer. All Rights Reserved. # # Contributor(s): +# Benjamin Smedberg # # Alternatively, the contents of this file may be used under the terms of # either of the GNU General Public License Version 2 or later (the "GPL"), @@ -42,6 +43,9 @@ VPATH = @srcdir@ include $(DEPTH)/config/autoconf.mk +# This makefile builds the "program" subdirectory. +DIRS = program + # MODULE specifies where header files from this Makefile are installed, # i.e. dist/include/xpcomsample MODULE = xpcomsample @@ -65,10 +69,6 @@ IS_COMPONENT = 1 # name specified in NS_IMPL_NSGETMODULE MODULE_NAME = nsSampleModule -# Ensure that the xpcom classes that we build -# do not export themselves -DEFINES += -DXPCOM_GLUE - # CPPSRCS specifies C++ files to be built into a library. CPPSRCS = \ nsSample.cpp \ @@ -79,11 +79,6 @@ CPPSRCS = \ # files to generate C++ headers and .xpt typelib files. XPIDLSRCS = nsISample.idl -TESTCPPSRCS = nsTestSample.cpp - -# SIMPLE_PROGRAMS builds an executable program from a single source file. -SIMPLE_PROGRAMS = $(TESTCPPSRCS:.cpp=$(BIN_SUFFIX)) - include $(topsrcdir)/config/config.mk # EXTRA_COMPONENTS installs components written JavaScript to @@ -91,33 +86,25 @@ include $(topsrcdir)/config/config.mk EXTRA_COMPONENTS = nsSample.js # EXTRA_DSO_LDOPTS specifies linker flags when building a shared library -# from this Makefile +# from this Makefile. We link against the "dependent glue" and against the +# frozen XPCOM shared library. EXTRA_DSO_LDOPTS = \ - $(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \ - $(NSPR_LIBS) \ + $(DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ + $(MOZ_COMPONENT_LIBS) \ $(NULL) -# LIBS specifies linker flags when building an executable program from -# this Makefile. -LIBS = \ - $(DIST)/lib/$(LIB_PREFIX)xpcomglue.$(LIB_SUFFIX) \ - $(NSPR_LIBS) \ - $(NULL) +# XXXNOTE: We should be using XPCOM_FROZEN_LDOPTS instead of +# MOZ_COMPONENT_LIBS, but that doesn't work on mac xcode < 1.5 and +# on some other ports yet. Soon! +# $(XPCOM_FROZEN_LDOPTS) \ +# $(NSPR_LIBS) \ -# Needed to resolve __yylex (?) -ifeq ($(OS_ARCH)$(OS_RELEASE),FreeBSD2) -LIBS += -lpcap -endif # Need to link with CoreFoundation on Mac ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) EXTRA_DSO_LDOPTS += \ $(TK_LIBS) \ $(NULL) - -LIBS += \ - $(TK_LIBS) \ - $(NULL) endif include $(topsrcdir)/config/rules.mk diff --git a/mozilla/xpcom/sample/program/Makefile.in b/mozilla/xpcom/sample/program/Makefile.in new file mode 100644 index 00000000000..4996a3568cf --- /dev/null +++ b/mozilla/xpcom/sample/program/Makefile.in @@ -0,0 +1,80 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Netscape Communications Corporation. +# Portions created by the Initial Developer are Copyright (C) 1998 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Benjamin Smedberg +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = xpcomsample + +# We must specify CPPSRCS in order to link using the proper c++ linker +# on certain platforms. +CPPSRCS = nsTestSample.cpp + +# SIMPLE_PROGRAMS compiles a single .cpp file into an executable +SIMPLE_PROGRAMS = nsTestSample$(BIN_SUFFIX) + +# LIBS specifies linker flags when building an executable program from +# this Makefile. We link against the "standalone glue" which does not require +# that the application be linked against the XPCOM dynamic library or the NSPR +# dynamic libraries. +LIBS = \ + $(XPCOM_STANDALONE_GLUE_LDOPTS) \ + $(NULL) + +# XXXbsmedberg temporary hack! The standalone glue still depends on NSPR +# except on mac; this will be fixed soon! +ifneq (Darwin,$(OS_ARCH)) +LIBS += $(NSPR_LIBS) +endif + +# Need to link with CoreFoundation on Mac +ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) +LIBS += \ + $(TK_LIBS) \ + $(NULL) +endif + +# Whatever code is going to be linked with the *standalone* glue must be +# built with the XPCOM_GLUE define set. +DEFINES += -DXPCOM_GLUE + +include $(topsrcdir)/config/rules.mk diff --git a/mozilla/xpcom/sample/nsTestSample.cpp b/mozilla/xpcom/sample/program/nsTestSample.cpp similarity index 94% rename from mozilla/xpcom/sample/nsTestSample.cpp rename to mozilla/xpcom/sample/program/nsTestSample.cpp index 84d86316180..8294461ec4f 100644 --- a/mozilla/xpcom/sample/nsTestSample.cpp +++ b/mozilla/xpcom/sample/program/nsTestSample.cpp @@ -44,6 +44,7 @@ #include +#include "nsXPCOMGlue.h" #include "nsXPCOM.h" #include "nsCOMPtr.h" #include "nsISample.h" @@ -51,13 +52,6 @@ #include "nsIComponentManager.h" #include "nsIComponentRegistrar.h" -#ifdef XPCOM_GLUE -#include "nsXPCOMGlue.h" -#include "nsMemory.h" -#else -#include "nsXPIDLString.h" -#endif - #define NS_SAMPLE_CONTRACTID "@mozilla.org/sample;1" int @@ -65,9 +59,7 @@ main(void) { nsresult rv; -#ifdef XPCOM_GLUE XPCOMGlueStartup(nsnull); -#endif // Initialize XPCOM nsCOMPtr servMan; @@ -119,13 +111,8 @@ main(void) return -3; } printf("Set value to: %s\n", testValue); -#ifndef XPCOM_GLUE - nsXPIDLCString str; - rv = mysample->GetValue(getter_Copies(str)); -#else char *str; rv = mysample->GetValue(&str); -#endif if (NS_FAILED(rv)) { @@ -138,9 +125,8 @@ main(void) return -4; } -#ifdef XPCOM_GLUE - nsMemory::Free(str); -#endif + NS_Free(str); + rv = mysample->WriteValue("Final print :"); printf("Test passed.\n"); @@ -154,8 +140,6 @@ main(void) // Shutdown XPCOM NS_ShutdownXPCOM(nsnull); -#ifdef XPCOM_GLUE XPCOMGlueShutdown(); -#endif return 0; } diff --git a/mozilla/xpcom/tools/registry/regxpcom.cpp b/mozilla/xpcom/tools/registry/regxpcom.cpp index b8822b8f63b..74c7981f3b5 100644 --- a/mozilla/xpcom/tools/registry/regxpcom.cpp +++ b/mozilla/xpcom/tools/registry/regxpcom.cpp @@ -59,7 +59,6 @@ static PRBool gUnreg = PR_FALSE, gQuiet = PR_FALSE; static const char* gXPCOMLocation = nsnull; static const char* gCompRegLocation = nsnull; static const char* gXPTIDatLocation = nsnull; -static char* gPathEnvString = nsnull; class DirectoryServiceProvider : public nsIDirectoryServiceProvider { @@ -120,21 +119,10 @@ int startup_xpcom() free(xpcomPath); - const char* path = PR_GetEnv(XPCOM_SEARCH_KEY); + const char* path = getenv(XPCOM_SEARCH_KEY); if (!path) { path = ""; } - - if (gPathEnvString) - PR_smprintf_free(gPathEnvString); - - gPathEnvString = PR_smprintf("%s=%s;%s", - XPCOM_SEARCH_KEY, - gXPCOMLocation, - path); - - if (gXPCOMLocation) - PR_SetEnv(gPathEnvString); } else { @@ -191,8 +179,6 @@ void shutdown_xpcom() if (NS_FAILED(rv)) { printf("Can not shutdown XPCOM Glue cleanly\n"); } - if (gPathEnvString) - PR_smprintf_free(gPathEnvString); }