[PATCH 02/11] lib: fwts_acpi_method: constify funcs and static tables
IvanHu
ivan.hu at canonical.com
Mon Oct 22 09:31:23 UTC 2012
On 10/17/2012 03:20 AM, Colin King wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> src/lib/include/fwts_acpi_method.h | 6 +++---
> src/lib/src/fwts_acpi_method.c | 19 +++++++++++++------
> 2 files changed, 16 insertions(+), 9 deletions(-)
>
> diff --git a/src/lib/include/fwts_acpi_method.h b/src/lib/include/fwts_acpi_method.h
> index acaf8db..0313ceb 100644
> --- a/src/lib/include/fwts_acpi_method.h
> +++ b/src/lib/include/fwts_acpi_method.h
> @@ -27,10 +27,10 @@
>
> int fwts_method_init(fwts_framework *fw);
> int fwts_method_deinit(fwts_framework *fw);
> -char *fwts_method_exists(char *name);
> +char *fwts_method_exists(const char *name);
> fwts_list *fwts_method_get_names(void);
> -void fwts_method_dump_object(fwts_framework *fw, ACPI_OBJECT *obj);
> -void fwts_method_evaluate_report_error(fwts_framework *fw, char *name, ACPI_STATUS status);
> +void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj);
> +void fwts_method_evaluate_report_error(fwts_framework *fw, const char *name, const ACPI_STATUS status);
> ACPI_STATUS fwts_method_evaluate(fwts_framework *fw, char *name, ACPI_OBJECT_LIST *arg_list, ACPI_BUFFER *buf);
>
> #endif
> diff --git a/src/lib/src/fwts_acpi_method.c b/src/lib/src/fwts_acpi_method.c
> index 7974545..d9d9883 100644
> --- a/src/lib/src/fwts_acpi_method.c
> +++ b/src/lib/src/fwts_acpi_method.c
> @@ -28,13 +28,13 @@
> #include "fwts_acpi_method.h"
>
> typedef struct {
> - ACPI_STATUS status;
> + const ACPI_STATUS status;
> const fwts_log_level level;
> const char *error_type;
> const char *error_text;
> } acpi_eval_error;
>
> -static acpi_eval_error errors[] = {
> +static const acpi_eval_error errors[] = {
> /* ACPI_STATUS fwts_log_level error_type error_text */
> { AE_ERROR, LOG_LEVEL_HIGH, "AEError", "Environment error" },
> { AE_NO_ACPI_TABLES, LOG_LEVEL_HIGH, "AENoACPITables", "NO ACPI tables" },
> @@ -160,7 +160,7 @@ fwts_list *fwts_method_get_names(void)
> * fwts_method_exists()
> * return first matching name
> */
> -char *fwts_method_exists(char *name)
> +char *fwts_method_exists(const char *name)
> {
> size_t name_len = strlen(name);
> fwts_list_link *item;
> @@ -180,7 +180,11 @@ char *fwts_method_exists(char *name)
> * fwts_method_dump_object()
> * dump out an object, minimal form
> */
> -static void fwts_method_dump_object_recursive(fwts_framework *fw, ACPI_OBJECT *obj, int depth, int index)
> +static void fwts_method_dump_object_recursive(
> + fwts_framework *fw,
> + const ACPI_OBJECT *obj,
> + const int depth,
> + const int index)
> {
> uint32_t i;
> char index_buf[5];
> @@ -222,7 +226,7 @@ static void fwts_method_dump_object_recursive(fwts_framework *fw, ACPI_OBJECT *o
> * fwts_method_dump_object()
> * dump out an object, minimal form
> */
> -void fwts_method_dump_object(fwts_framework *fw, ACPI_OBJECT *obj)
> +void fwts_method_dump_object(fwts_framework *fw, const ACPI_OBJECT *obj)
> {
> fwts_method_dump_object_recursive(fw, obj, 1, -1);
> }
> @@ -231,7 +235,10 @@ void fwts_method_dump_object(fwts_framework *fw, ACPI_OBJECT *obj)
> * fwts_method_evaluate_report_error()
> * report any errors found during object evaluation
> */
> -void fwts_method_evaluate_report_error(fwts_framework *fw, char *name, ACPI_STATUS status)
> +void fwts_method_evaluate_report_error(
> + fwts_framework *fw,
> + const char *name,
> + const ACPI_STATUS status)
> {
> int i;
>
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list