diff options
author | Valeri Atamaniouk <valeria@codeaurora.org> | 2015-10-21 18:53:58 +0300 |
---|---|---|
committer | Valeri Atamaniouk <valeria@codeaurora.org> | 2015-11-09 11:33:15 +0200 |
commit | 78bb13288e9ac69a985cf8a4b8c15b21770b59c5 (patch) | |
tree | 16c9b3b8582db269f758c24b3a44c439539fa7ff /utils/loc_log.h | |
parent | 15ea4fca381ca7cc2085fae72318a9b0c1cedbed (diff) | |
download | gps-78bb13288e9ac69a985cf8a4b8c15b21770b59c5.tar.gz |
Location: reduce memory footprint
Reduce memory footprint by moving data sets into const
data segments. Update function parameters to accept const
parameters when appropriate.
CRs-fixed: 928770
Change-Id: I42955cf18de2b0541cfaed89359cdcf9ae6fea8a
Diffstat (limited to 'utils/loc_log.h')
-rw-r--r-- | utils/loc_log.h | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/utils/loc_log.h b/utils/loc_log.h index 82dc636..be492b1 100644 --- a/utils/loc_log.h +++ b/utils/loc_log.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved. +/* Copyright (c) 2011-2012, 2015 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -36,12 +36,13 @@ extern "C" #endif #include <ctype.h> +#include <stdlib.h> #include "loc_target.h" typedef struct { - char name[128]; - long val; + const char *name; + long val; } loc_name_val_s_type; #define NAME_VAL(x) {"" #x "", x } @@ -49,17 +50,19 @@ typedef struct #define UNKNOWN_STR "UNKNOWN" #define CHECK_MASK(type, value, mask_var, mask) \ - ((mask_var & mask) ? (type) value : (type) (-1)) + (((mask_var) & (mask)) ? (type) (value) : (type) (-1)) + +#define LOC_TABLE_SIZE(table) (sizeof(table)/sizeof((table)[0])) /* Get names from value */ -const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask); -const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value); +const char* loc_get_name_from_mask(const loc_name_val_s_type table[], size_t table_size, long mask); +const char* loc_get_name_from_val(const loc_name_val_s_type table[], size_t table_size, long value); const char* loc_get_msg_q_status(int status); const char* loc_get_target_name(unsigned int target); extern const char* log_succ_fail_string(int is_succ); -extern char *loc_get_time(char *time_string, unsigned long buf_size); +extern char *loc_get_time(char *time_string, size_t buf_size); #ifdef __cplusplus } |