From fbee6b21a3820a55ec36a2aceb138f3973a955ac Mon Sep 17 00:00:00 2001 From: Lv Zheng Date: Tue, 8 Jul 2014 10:07:33 +0800 Subject: ACPICA: acpidump: Add memory/string OSL usage to improve portability This patch adds code to use generic OSL for acpidump to improve the portability of this tool. Lv Zheng. Signed-off-by: Lv Zheng Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki --- tools/power/acpi/tools/acpidump/apfiles.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tools/power/acpi/tools/acpidump/apfiles.c') diff --git a/tools/power/acpi/tools/acpidump/apfiles.c b/tools/power/acpi/tools/acpidump/apfiles.c index 4488accc010b..1d12b9d3d44e 100644 --- a/tools/power/acpi/tools/acpidump/apfiles.c +++ b/tools/power/acpi/tools/acpidump/apfiles.c @@ -130,11 +130,12 @@ int ap_write_to_binary_file(struct acpi_table_header *table, u32 instance) /* Handle multiple SSDts - create different filenames for each */ if (instance > 0) { - sprintf(instance_str, "%u", instance); - strcat(filename, instance_str); + acpi_ut_snprintf(instance_str, sizeof(instance_str), "%u", + instance); + ACPI_STRCAT(filename, instance_str); } - strcat(filename, ACPI_TABLE_FILE_SUFFIX); + ACPI_STRCAT(filename, ACPI_TABLE_FILE_SUFFIX); if (gbl_verbose_mode) { fprintf(stderr, @@ -202,7 +203,7 @@ struct acpi_table_header *ap_get_table_from_file(char *pathname, /* Allocate a buffer for the entire file */ - buffer = calloc(1, file_size); + buffer = ACPI_ALLOCATE_ZEROED(file_size); if (!buffer) { fprintf(stderr, "Could not allocate file buffer of size: %u\n", @@ -215,7 +216,7 @@ struct acpi_table_header *ap_get_table_from_file(char *pathname, actual = fread(buffer, 1, file_size, file); if (actual != file_size) { fprintf(stderr, "Could not read input file: %s\n", pathname); - free(buffer); + ACPI_FREE(buffer); buffer = NULL; goto cleanup; } -- cgit v1.2.3-59-g8ed1b