Skip to content

Commit 1db1f16

Browse files
authored
avoid unnecessary copy for rcutils_char_array_vsprintf. (ros2#412)
Signed-off-by: Tomoya Fujita <Tomoya.Fujita@sony.com>
1 parent 591166b commit 1db1f16

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

src/logging.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,14 +1311,11 @@ void rcutils_logging_console_output_handler(
13111311
}
13121312

13131313
if (RCUTILS_RET_OK == status) {
1314-
va_list args_clone;
1315-
va_copy(args_clone, *args);
1316-
status = rcutils_char_array_vsprintf(&msg_array, format, args_clone);
1314+
status = rcutils_char_array_vsprintf(&msg_array, format, *args);
13171315
if (RCUTILS_RET_OK != status) {
13181316
RCUTILS_SAFE_FWRITE_TO_STDERR_WITH_FORMAT_STRING(
13191317
"Error: rcutils_char_array_vsprintf failed with: %d\n", status);
13201318
}
1321-
va_end(args_clone);
13221319
}
13231320

13241321
if (RCUTILS_RET_OK == status) {

0 commit comments

Comments
 (0)