Bug 670201 - Remove most #ifdef DEBUG from custom loader. r=mwu
authorDoug Turner <dougt@dougt.org>
Sat, 09 Jul 2011 19:50:22 -0700
changeset 72535 1b07d9f68d1934237f9d718b924c14329e689d31
parent 72534 acc1dab8593ca54e674370e75a4b4cbcad475bfa
child 72536 cb5d55ec3e5d7cb08ba1695c67fd31905c14304c
push id467
push userdougt@mozilla.com
push dateSun, 10 Jul 2011 02:56:20 +0000
treeherdermozilla-inbound@1b07d9f68d19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs670201
milestone8.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 670201 - Remove most #ifdef DEBUG from custom loader. r=mwu
other-licenses/android/APKOpen.cpp
other-licenses/android/dlfcn.c
--- a/other-licenses/android/APKOpen.cpp
+++ b/other-licenses/android/APKOpen.cpp
@@ -244,21 +244,16 @@ SHELL_WRAPPER1(reportJavaCrash, jstring)
 static void * xul_handle = NULL;
 static time_t apk_mtime = 0;
 #ifdef DEBUG
 extern "C" int extractLibs = 1;
 #else
 extern "C" int extractLibs = 0;
 #endif
 
-#ifdef DEBUG
-#define DEBUG_EXTRACT_LIBS 1
-#endif
-
-#ifdef DEBUG_EXTRACT_LIBS
 static uint32_t simple_write(int fd, const void *buf, uint32_t count)
 {
   uint32_t out_offset = 0;
   while (out_offset < count) {
     uint32_t written = write(fd, buf + out_offset,
                              count - out_offset);
     if (written == -1) {
       if (errno == EAGAIN || errno == EWOULDBLOCK)
@@ -328,17 +323,16 @@ extractFile(const char * path, const str
 
   ret = inflateEnd(&strm);
   if (ret != Z_OK)
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "inflateEnd failed: %s", strm.msg);
 
   close(fd);
   munmap(buf, 4096);
 }
-#endif
 
 static void
 extractLib(const struct cdir_entry *entry, void * data, void * dest)
 {
   z_stream strm = {
     next_in: (Bytef *)data,
     avail_in: letoh32(entry->compressed_size),
     total_in: 0,
@@ -449,17 +443,16 @@ static void * mozload(const char * path,
   gettimeofday(&t0, 0);
 #endif
 
   struct cdir_entry *entry = find_cdir_entry(cdir_start, cdir_entries, path);
   struct local_file_header *file = (struct local_file_header *)(zip + letoh32(entry->offset));
   void * data = ((void *)&file->data) + letoh16(file->filename_size) + letoh16(file->extra_field_size);
   void * handle;
 
-#ifdef DEBUG_EXTRACT_LIBS
   if (extractLibs) {
     char fullpath[PATH_MAX];
     snprintf(fullpath, PATH_MAX, "%s/%s", getenv("CACHE_PATH"), path + 4);
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "resolved %s to %s", path, fullpath);
     extractFile(fullpath, entry, data);
     handle = __wrap_dlopen(fullpath, RTLD_LAZY);
     if (!handle)
       __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "Couldn't load %s because %s", fullpath, __wrap_dlerror());
@@ -468,17 +461,17 @@ static void * mozload(const char * path,
     __android_log_print(ANDROID_LOG_ERROR, "GeckoLibLoad", "%s: spent %d", path,
                         (((long long)t1.tv_sec * 1000000LL) +
                           (long long)t1.tv_usec) -
                         (((long long)t0.tv_sec * 1000000LL) +
                           (long long)t0.tv_usec));
 #endif
     return handle;
   }
-#endif
+
   size_t offset = letoh32(entry->offset) + sizeof(*file) + letoh16(file->filename_size) + letoh16(file->extra_field_size);
   bool skipLibCache = false;
   int fd = zip_fd;
   void * buf = NULL;
   uint32_t lib_size = letoh32(entry->uncompressed_size);
   int cache_fd = 0;
   if (letoh16(file->compression) == DEFLATE) {
     cache_fd = lookupLibCacheFd(path + 4);
--- a/other-licenses/android/dlfcn.c
+++ b/other-licenses/android/dlfcn.c
@@ -49,20 +49,18 @@ static void set_dlerror(int err)
 {
     format_buffer(dl_err_buf, sizeof(dl_err_buf), "%s: %s", dl_errors[err],
              linker_get_error());
     dl_err_str = (const char *)&dl_err_buf[0];
 }
 
 void *__wrap_dlopen(const char *filename, int flag)
 {
-#ifdef DEBUG
     if (extractLibs)
         return dlopen(filename, flag);
-#endif
 
     soinfo *ret;
 
     pthread_mutex_lock(&dl_lock);
     ret = find_library(filename);
     if (unlikely(ret == NULL)) {
         set_dlerror(DL_ERR_CANNOT_LOAD_LIBRARY);
     } else {