equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
542 return result; |
542 return result; |
543 } |
543 } |
544 |
544 |
545 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
545 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
546 if (str != NULL) { |
546 if (str != NULL) { |
547 size_t len = strlen(str); |
547 return os::strdup_check_oom(str, mtInternal); |
548 char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); |
|
549 strncpy(tmp, str, len); |
|
550 tmp[len] = '\0'; |
|
551 return tmp; |
|
552 } |
548 } |
553 return NULL; |
549 return NULL; |
554 } |
550 } |
555 |
551 |
556 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |
552 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |