src/share/vm/runtime/arguments.cpp

changeset 9756
2be326848943
parent 9637
eef07cd490d4
parent 9711
0f2fe7d37d8c
child 9852
70aa912cebe5
     1.1 --- a/src/share/vm/runtime/arguments.cpp	Sat Nov 09 20:15:27 2019 +0800
     1.2 +++ b/src/share/vm/runtime/arguments.cpp	Sat Nov 09 20:29:45 2019 +0800
     1.3 @@ -556,8 +556,7 @@
     1.4  
     1.5    /* Scan the directory for jars/zips, appending them to path. */
     1.6    struct dirent *entry;
     1.7 -  char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
     1.8 -  while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
     1.9 +  while ((entry = os::readdir(dir)) != NULL) {
    1.10      const char* name = entry->d_name;
    1.11      const char* ext = name + strlen(name) - 4;
    1.12      bool isJarOrZip = ext > name &&
    1.13 @@ -571,7 +570,6 @@
    1.14        FREE_C_HEAP_ARRAY(char, jarpath, mtInternal);
    1.15      }
    1.16    }
    1.17 -  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
    1.18    os::closedir(dir);
    1.19    return path;
    1.20  }
    1.21 @@ -3485,14 +3483,12 @@
    1.22    if (dir == NULL) return false;
    1.23  
    1.24    struct dirent *entry;
    1.25 -  char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
    1.26    bool hasJarFile = false;
    1.27 -  while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
    1.28 +  while (!hasJarFile && (entry = os::readdir(dir)) != NULL) {
    1.29      const char* name = entry->d_name;
    1.30      const char* ext = name + strlen(name) - 4;
    1.31      hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
    1.32    }
    1.33 -  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
    1.34    os::closedir(dir);
    1.35    return hasJarFile ;
    1.36  }
    1.37 @@ -3574,8 +3570,7 @@
    1.38    if (dir != NULL) {
    1.39      int num_ext_jars = 0;
    1.40      struct dirent *entry;
    1.41 -    char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(extDir), mtInternal);
    1.42 -    while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
    1.43 +    while ((entry = os::readdir(dir)) != NULL) {
    1.44        const char* name = entry->d_name;
    1.45        const char* ext = name + strlen(name) - 4;
    1.46        if (ext > name && (os::file_name_strcmp(ext, ".jar") == 0)) {
    1.47 @@ -3594,7 +3589,6 @@
    1.48          }
    1.49        }
    1.50      }
    1.51 -    FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
    1.52      os::closedir(dir);
    1.53      if (num_ext_jars > 0) {
    1.54        nonEmptyDirs += 1;

mercurial