- Remove unnecessary assignments operation
- Add memory free before return statements
Change-Id: I3e2a4f29982d8e0295ad94791aa818f2e7e7a629
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append_c(dump_p, ',');
- dump_p = g_string_append(dump_p, DUMP_DATA_TAG_1);
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append_c(dump_p, ',');
+ g_string_append(dump_p, DUMP_DATA_TAG_1);
+ g_string_append_c(dump_p, ',');
g_string_append_printf(dump_p, "%d,", pool_info->sp_idx);
g_string_append_printf(dump_p, "%d,", pool_info->uid);
g_string_append_printf(dump_p, "%d,", pool_info->sp_idx);
g_string_append_printf(dump_p, "%d,", pool_info->uid);
- dump_p = g_string_append(dump_p, "\"");
+ g_string_append(dump_p, "\"");
if (pool_info->string_info != NULL) {
gchar *temp = g_strdup(pool_info->string_info->str);
if (pool_info->string_info != NULL) {
gchar *temp = g_strdup(pool_info->string_info->str);
- dump_p = g_string_append(dump_p, temp);
+ g_string_append(dump_p, temp);
- dump_p = g_string_append(dump_p, "\"");
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\"");
+ g_string_append(dump_p, "\n");
_DBG("%s", dump_p->str);
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
_DBG("%s", dump_p->str);
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append(dump_p, ",0");
- dump_p = g_string_append(dump_p, ",i");
- dump_p = g_string_append(dump_p, ",vers");
- dump_p = g_string_append(dump_p, ",19,150,NMF26V,NMF26V");
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append(dump_p, ",0");
+ g_string_append(dump_p, ",i");
+ g_string_append(dump_p, ",vers");
+ g_string_append(dump_p, ",19,150,NMF26V,NMF26V");
+ g_string_append(dump_p, "\n");
_DBG("%s", dump_p->str);
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
g_free(dump_p->str);
int ret = BATTERY_MONITOR_ERROR_NONE;
_DBG("%s", dump_p->str);
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
g_free(dump_p->str);
int ret = BATTERY_MONITOR_ERROR_NONE;
- int log_count = h_count;int pool_count = 0;
+ int log_count = h_count; int pool_count = 0;
for (int i = 0; i < log_count; i++) {
history_tag_s *pool_info = NULL;
if (history_data[i].event_tag != NULL) {
for (int i = 0; i < log_count; i++) {
history_tag_s *pool_info = NULL;
if (history_data[i].event_tag != NULL) {
g_string_append_printf(dump_p, "%d,", pool_info->uid);
if (pool_info->string_info != NULL) {
gchar *temp = g_strdup(pool_info->string_info->str);
g_string_append_printf(dump_p, "%d,", pool_info->uid);
if (pool_info->string_info != NULL) {
gchar *temp = g_strdup(pool_info->string_info->str);
- dump_p = g_string_append(dump_p, temp);
+ g_string_append(dump_p, temp);
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\n");
_DBG("%s", dump_p->str);//write
g_free(dump_p->str);
EXIT;
_DBG("%s", dump_p->str);//write
g_free(dump_p->str);
EXIT;
// move there and modify
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
// move there and modify
GString *dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append(dump_p, ",0");
- dump_p = g_string_append(dump_p, ",i");
- dump_p = g_string_append(dump_p, ",uid,");
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append(dump_p, ",0");
+ g_string_append(dump_p, ",i");
+ g_string_append(dump_p, ",uid,");
int ret = BATTERY_MONITOR_ERROR_NONE;
int log_count = h_count;
for (int i = 0; i < log_count; i++) {
int ret = BATTERY_MONITOR_ERROR_NONE;
int log_count = h_count;
for (int i = 0; i < log_count; i++) {
// Dump brightness Data
bd_gl_sbr_stat_s *gbr_stat = (bd_gl_sbr_stat_s *)calloc(1, sizeof(bd_gl_sbr_stat_s));
BM_CHECK_MEM_ALLOC(gbr_stat, {});
// Dump brightness Data
bd_gl_sbr_stat_s *gbr_stat = (bd_gl_sbr_stat_s *)calloc(1, sizeof(bd_gl_sbr_stat_s));
BM_CHECK_MEM_ALLOC(gbr_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gbr_stat, 3, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gbr_stat, 3, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gbr_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "br,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "br,");
bd_gl_ntw_stat_s *gn_stat = (bd_gl_ntw_stat_s *)calloc(1, sizeof(bd_gl_ntw_stat_s));
BM_CHECK_MEM_ALLOC(gn_stat, {});
bd_gl_ntw_stat_s *gn_stat = (bd_gl_ntw_stat_s *)calloc(1, sizeof(bd_gl_ntw_stat_s));
BM_CHECK_MEM_ALLOC(gn_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
-
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gn_stat, 2, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gn_stat, 2, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gn_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gn,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gn,");
g_string_append_printf(dump_p, "%d,", 0); //add this to struct as well
g_string_append_printf(dump_p, "%d", 0);
g_string_append(dump_p, "\n");
g_string_append_printf(dump_p, "%d,", 0); //add this to struct as well
g_string_append_printf(dump_p, "%d", 0);
g_string_append(dump_p, "\n");
_DBG("%s", dump_p->str);//write
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
_DBG("%s", dump_p->str);//write
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
// Dump Wifi Stats
bd_gl_wifi_stat_s *gwfl_stat = (bd_gl_wifi_stat_s *)calloc(1, sizeof(bd_gl_wifi_stat_s));
BM_CHECK_MEM_ALLOC(gwfl_stat, {});
// Dump Wifi Stats
bd_gl_wifi_stat_s *gwfl_stat = (bd_gl_wifi_stat_s *)calloc(1, sizeof(bd_gl_wifi_stat_s));
BM_CHECK_MEM_ALLOC(gwfl_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gwfl_stat, 1, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gwfl_stat, 1, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gwfl_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gwfl,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gwfl,");
g_free(dump_p->str);
dump_p = g_string_sized_new(30);
g_free(dump_p->str);
dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gwfl_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gwfcd,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gwfcd,");
// Dump bt Data
bd_gl_ble_stat_s *gble_stat = (bd_gl_ble_stat_s *)calloc(1, sizeof(bd_gl_ble_stat_s));
BM_CHECK_MEM_ALLOC(gble_stat, {});
// Dump bt Data
bd_gl_ble_stat_s *gble_stat = (bd_gl_ble_stat_s *)calloc(1, sizeof(bd_gl_ble_stat_s));
BM_CHECK_MEM_ALLOC(gble_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gble_stat, 0, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gble_stat, 0, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gble_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gble,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "gble,");
ENTER;
bd_gl_sgt_stat_s *gst_stat = (bd_gl_sgt_stat_s *)calloc(1, sizeof(bd_gl_sgt_stat_s));
BM_CHECK_MEM_ALLOC(gst_stat, {});
ENTER;
bd_gl_sgt_stat_s *gst_stat = (bd_gl_sgt_stat_s *)calloc(1, sizeof(bd_gl_sgt_stat_s));
BM_CHECK_MEM_ALLOC(gst_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gst_stat, 4, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gst_stat, 4, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gst_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "sgt,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "sgt,");
g_free(dump_p->str);
dump_p = g_string_sized_new(30);
g_free(dump_p->str);
dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gst_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "sst,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "sst,");
ENTER;
bd_gl_wst_stat_s *gwst_stat = (bd_gl_wst_stat_s *)calloc(1, sizeof(bd_gl_wst_stat_s));
BM_CHECK_MEM_ALLOC(gwst_stat, {});
ENTER;
bd_gl_wst_stat_s *gwst_stat = (bd_gl_wst_stat_s *)calloc(1, sizeof(bd_gl_wst_stat_s));
BM_CHECK_MEM_ALLOC(gwst_stat, {});
- GString *dump_p = g_string_sized_new(30);
- BM_CHECK_MEM_ALLOC(dump_p, {});
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gwst_stat, 5, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
int ret = BATTERY_MONITOR_ERROR_NONE;
ret = bm_server_battery_dump_query_from_db(gwst_stat, 5, duration);
if (ret != BATTERY_MONITOR_ERROR_NONE) {
_ERR("Unable to fetch data from DB");
+
+ GString *dump_p = g_string_sized_new(30);
+ BM_CHECK_MEM_ALLOC(dump_p, {BM_FREE(gwst_stat); });
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "wsgt,");
g_string_append(dump_p, TIZEN_DUMP_VERSION);
g_string_append(dump_p, ",0,l,");
g_string_append(dump_p, "wsgt,");
GSList *iter = NULL; GString *dump_p = NULL;
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {bm_set_free_gslist_appid_map(list); });
GSList *iter = NULL; GString *dump_p = NULL;
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {bm_set_free_gslist_appid_map(list); });
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append(dump_p, ",0,i,uid,1000,tizen\n");
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append(dump_p, ",0,i,uid,1000,tizen\n");
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
g_free(dump_p->str);
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
g_free(dump_p->str);
for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {bm_set_free_gslist_appid_map(list); });
for (iter = list; iter != NULL; iter = g_slist_next(iter)) {
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {bm_set_free_gslist_appid_map(list); });
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append(dump_p, ",0");
- dump_p = g_string_append(dump_p, ",i");
- dump_p = g_string_append(dump_p, ",uid,");
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append(dump_p, ",0");
+ g_string_append(dump_p, ",i");
+ g_string_append(dump_p, ",uid,");
appid_map_s *amap_data = (appid_map_s *)iter->data;
g_string_append_printf(dump_p, "%d,", (amap_data->id+10000));
gchar *temp_str = g_strdup(amap_data->AppId);
g_string_append(dump_p, amap_data->AppId);
appid_map_s *amap_data = (appid_map_s *)iter->data;
g_string_append_printf(dump_p, "%d,", (amap_data->id+10000));
gchar *temp_str = g_strdup(amap_data->AppId);
g_string_append(dump_p, amap_data->AppId);
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\n");
_DBG("%s", dump_p->str);//write
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
_DBG("%s", dump_p->str);//write
if (write(fd, dump_p->str, dump_p->len) < 0)
_WARN("write error");
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
if (chkin) {
dump_p = g_string_sized_new(30);
BM_CHECK_MEM_ALLOC(dump_p, {});
if (chkin) {
- dump_p = g_string_append(dump_p, TIZEN_DUMP_VERSION);
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append(dump_p, TIZEN_DUMP_VERSION);
+ g_string_append_c(dump_p, ',');
_DBG("value %s", dump_p->str);
_DBG("value %s", dump_p->str);
- dump_p = g_string_append(dump_p, DUMP_DATA_TAG);
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append(dump_p, DUMP_DATA_TAG);
+ g_string_append_c(dump_p, ',');
_DBG("value %s", dump_p->str);
if (old_state.time_s < 0) {
g_string_append_printf(dump_p, "%lld",
_DBG("value %s", dump_p->str);
if (old_state.time_s < 0) {
g_string_append_printf(dump_p, "%lld",
}
if (new_state.cmd_s == CM_ST) {
if (chkin) {
}
if (new_state.cmd_s == CM_ST) {
if (chkin) {
- dump_p = g_string_append_c(dump_p, ':');
+ g_string_append_c(dump_p, ':');
_DBG("value %s", dump_p->str);
} else {
//NC
}
_DBG("value %s", dump_p->str);
} else {
//NC
}
- dump_p = g_string_append(dump_p, "START\n");
+ g_string_append(dump_p, "START\n");
_DBG("value %s", dump_p->str);
bd_print_history_item_reset(&old_state);
} else if (new_state.cmd_s == CM_CRR_TIME || new_state.cmd_s == CM_RST) {
if (chkin) {
_DBG("value %s", dump_p->str);
bd_print_history_item_reset(&old_state);
} else if (new_state.cmd_s == CM_CRR_TIME || new_state.cmd_s == CM_RST) {
if (chkin) {
- dump_p = g_string_append_c(dump_p, ':');
+ g_string_append_c(dump_p, ':');
_DBG("value %s", dump_p->str);
}
if (new_state.cmd_s == CM_RST) {
_DBG("value %s", dump_p->str);
}
if (new_state.cmd_s == CM_RST) {
- dump_p = g_string_append(dump_p, "RESET:");
+ g_string_append(dump_p, "RESET:");
_DBG("value %s", dump_p->str);
bd_print_history_item_reset(&old_state);
}
_DBG("value %s", dump_p->str);
bd_print_history_item_reset(&old_state);
}
- dump_p = g_string_append(dump_p, "TIME:");
+ g_string_append(dump_p, "TIME:");
_DBG("value %s", dump_p->str);
if (chkin) {
g_string_append_printf(dump_p, "%lld", new_state.time_current);
_DBG("value %s", dump_p->str);
_DBG("value %s", dump_p->str);
if (chkin) {
g_string_append_printf(dump_p, "%lld", new_state.time_current);
_DBG("value %s", dump_p->str);
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\n");
_DBG("value %s", dump_p->str);
} else {
//NC
}
} else if (new_state.cmd_s == CM_SHTDN) {
if (chkin) {
_DBG("value %s", dump_p->str);
} else {
//NC
}
} else if (new_state.cmd_s == CM_SHTDN) {
if (chkin) {
- dump_p = g_string_append_c(dump_p, ':');
+ g_string_append_c(dump_p, ':');
_DBG("value %s", dump_p->str);
} else {
//NC
}
_DBG("value %s", dump_p->str);
} else {
//NC
}
- dump_p = g_string_append(dump_p, "SHUTDOWN\n");
+ g_string_append(dump_p, "SHUTDOWN\n");
_DBG("value %s", dump_p->str);
} else if (new_state.cmd_s == CM_OVRFL) {
if (chkin) {
_DBG("value %s", dump_p->str);
} else if (new_state.cmd_s == CM_OVRFL) {
if (chkin) {
- dump_p = g_string_append_c(dump_p, ':');
+ g_string_append_c(dump_p, ':');
_DBG("value %s", dump_p->str);
}
_DBG("value %s", dump_p->str);
}
- dump_p = g_string_append(dump_p, "*OVERFLOW*\n");
+ g_string_append(dump_p, "*OVERFLOW*\n");
_DBG("value %s", dump_p->str);
} else if (new_state.cmd_s == CM_USAGE) {
for (int i = 0; i < 32; i++) {
if (new_state.usage_type == (1 << i)) {
_DBG("value %s", dump_p->str);
} else if (new_state.cmd_s == CM_USAGE) {
for (int i = 0; i < 32; i++) {
if (new_state.usage_type == (1 << i)) {
- dump_p = g_string_append(dump_p, ",");
+ g_string_append(dump_p, ",");
g_string_append_printf(dump_p, "%s", usage_map[i]);
g_string_append_printf(dump_p, "%s", usage_map[i]);
- dump_p = g_string_append(dump_p, "=");
+ g_string_append(dump_p, "=");
g_string_append_printf(dump_p, "%d", new_state.usage);
g_string_append_printf(dump_p, "%d", new_state.usage);
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\n");
_DBG("value %d", new_state.usage);
}
}
_DBG("value %d", new_state.usage);
}
}
} else {
if (old_state.battery_level != new_state.battery_level) {
old_state.battery_level = new_state.battery_level;
} else {
if (old_state.battery_level != new_state.battery_level) {
old_state.battery_level = new_state.battery_level;
- dump_p = g_string_append(dump_p, ",Bl=");
+ g_string_append(dump_p, ",Bl=");
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d",
new_state.battery_level);
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d",
new_state.battery_level);
}
if (old_state.battery_status != new_state.battery_status) {
old_state.battery_status = new_state.battery_status;
}
if (old_state.battery_status != new_state.battery_status) {
old_state.battery_status = new_state.battery_status;
- dump_p = g_string_append(dump_p, ",Bs="); //:for NC
+ g_string_append(dump_p, ",Bs="); //:for NC
_DBG("value %s", dump_p->str);
switch (old_state.battery_status) {
case BD_BSTA_UNKN:
_DBG("value %s", dump_p->str);
switch (old_state.battery_status) {
case BD_BSTA_UNKN:
}
if (old_state.battery_health != new_state.battery_health) {
old_state.battery_health = new_state.battery_health;
}
if (old_state.battery_health != new_state.battery_health) {
old_state.battery_health = new_state.battery_health;
- dump_p = g_string_append(dump_p, ",Bh="); //:for NC
+ g_string_append(dump_p, ",Bh="); //:for NC
_DBG("value %s", dump_p->str);
switch (old_state.battery_health) {
case BD_BHLT_GOOD:
_DBG("value %s", dump_p->str);
switch (old_state.battery_health) {
case BD_BHLT_GOOD:
}
if (old_state.battery_plugtype != new_state.battery_plugtype) {
old_state.battery_plugtype = new_state.battery_plugtype;
}
if (old_state.battery_plugtype != new_state.battery_plugtype) {
old_state.battery_plugtype = new_state.battery_plugtype;
- dump_p = g_string_append(dump_p, ",Bp="); //:for NC
+ g_string_append(dump_p, ",Bp="); //:for NC
_DBG("value %s", dump_p->str);
switch (old_state.battery_plugtype) {
case BD_BPLT_DIS:
_DBG("value %s", dump_p->str);
switch (old_state.battery_plugtype) {
case BD_BPLT_DIS:
}
if (old_state.battery_temperature != new_state.battery_temperature) {
old_state.battery_temperature = new_state.battery_temperature;
}
if (old_state.battery_temperature != new_state.battery_temperature) {
old_state.battery_temperature = new_state.battery_temperature;
- dump_p = g_string_append(dump_p, ",Bt="); //:for NC
+ g_string_append(dump_p, ",Bt="); //:for NC
g_string_append_printf(dump_p, "%d",
new_state.battery_temperature);
_DBG("value %s", dump_p->str);
}
if (old_state.battery_voltage != new_state.battery_voltage) {
old_state.battery_voltage = new_state.battery_voltage;
g_string_append_printf(dump_p, "%d",
new_state.battery_temperature);
_DBG("value %s", dump_p->str);
}
if (old_state.battery_voltage != new_state.battery_voltage) {
old_state.battery_voltage = new_state.battery_voltage;
- dump_p = g_string_append(dump_p, ",Bv="); //:for NC
+ g_string_append(dump_p, ",Bv="); //:for NC
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d", new_state.battery_voltage);
_DBG("value %s", dump_p->str);
}
if (old_state.battery_charge != new_state.battery_charge) {
old_state.battery_charge = new_state.battery_charge;
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d", new_state.battery_voltage);
_DBG("value %s", dump_p->str);
}
if (old_state.battery_charge != new_state.battery_charge) {
old_state.battery_charge = new_state.battery_charge;
- dump_p = g_string_append(dump_p, ",Bcc=");
+ g_string_append(dump_p, ",Bcc=");
_DBG("value %s", dump_p->str);
//Charge in MAh
g_string_append_printf(dump_p, "%d", (new_state.battery_charge/1000));
_DBG("value %s", dump_p->str);
//Charge in MAh
g_string_append_printf(dump_p, "%d", (new_state.battery_charge/1000));
bool wake_fl = false; int k = 0;
if ((change & ST1_BRIGHTNESS_MASK) != 0) {
k = (new_state.state_1 & ST1_BRIGHTNESS_MASK);
bool wake_fl = false; int k = 0;
if ((change & ST1_BRIGHTNESS_MASK) != 0) {
k = (new_state.state_1 & ST1_BRIGHTNESS_MASK);
- dump_p = g_string_append(dump_p, ",Sb=");
+ g_string_append(dump_p, ",Sb=");
k = k >> ST1_BRIGHTNESS_SHIFT;
_DBG("Sb = %d", k);
g_string_append_printf(dump_p, "%d", k);
k = k >> ST1_BRIGHTNESS_SHIFT;
_DBG("Sb = %d", k);
g_string_append_printf(dump_p, "%d", k);
}
if ((change & ST1_PHONE_SIGNAL_STRENGTH_MASK) != 0) {
k = (new_state.state_1 & ST1_PHONE_SIGNAL_STRENGTH_MASK);
}
if ((change & ST1_PHONE_SIGNAL_STRENGTH_MASK) != 0) {
k = (new_state.state_1 & ST1_PHONE_SIGNAL_STRENGTH_MASK);
- dump_p = g_string_append(dump_p, ",Pss=");
+ g_string_append(dump_p, ",Pss=");
k = k >> ST1_PHONE_SIGNAL_STRENGTH_SHIFT;
_DBG("Pss = %d", k);
g_string_append_printf(dump_p, "%d", k);
k = k >> ST1_PHONE_SIGNAL_STRENGTH_SHIFT;
_DBG("Pss = %d", k);
g_string_append_printf(dump_p, "%d", k);
int shifts = (1 << 14);
for (int i = 14; i < 32; i++) {
if ((change & shifts) != 0) {
int shifts = (1 << 14);
for (int i = 14; i < 32; i++) {
if ((change & shifts) != 0) {
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append_c(dump_p, ',');
//Considering only -ve shift cases
int shift = -1;
if (shift < 0) {
//Considering only -ve shift cases
int shift = -1;
if (shift < 0) {
shifts = (shifts << 1);
}
if (!wake_fl && new_state.wakelock_tag != NULL) {
shifts = (shifts << 1);
}
if (!wake_fl && new_state.wakelock_tag != NULL) {
- dump_p = g_string_append(dump_p, ",w=");
+ g_string_append(dump_p, ",w=");
if (chkin) {
g_string_append_printf(dump_p, "%d",
new_state.wakelock_tag->sp_idx);
if (chkin) {
g_string_append_printf(dump_p, "%d",
new_state.wakelock_tag->sp_idx);
int shifts = 1;
for (int i = 0; i < 32; i++) {
if ((change & shifts) != 0) {
int shifts = 1;
for (int i = 0; i < 32; i++) {
if ((change & shifts) != 0) {
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append_c(dump_p, ',');
//_DBG("value %s", dump_p->str);
int shift = -1;
if (shift < 0) {
//_DBG("value %s", dump_p->str);
int shift = -1;
if (shift < 0) {
}
if (new_state.wakereason_tag != NULL) {
if (chkin) {
}
if (new_state.wakereason_tag != NULL) {
if (chkin) {
- dump_p = g_string_append(dump_p, ",wr=");
+ g_string_append(dump_p, ",wr=");
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d",
new_state.wakereason_tag->sp_idx);
_DBG("value %s", dump_p->str);
g_string_append_printf(dump_p, "%d",
new_state.wakereason_tag->sp_idx);
//: for NC
}
if (new_state.event_code != ET_NONE) {
//: for NC
}
if (new_state.event_code != ET_NONE) {
- dump_p = g_string_append_c(dump_p, ',');
+ g_string_append_c(dump_p, ',');
_DBG("value %s", dump_p->str);
if ((new_state.event_code & ET_FLAG_START) != 0)
_DBG("value %s", dump_p->str);
if ((new_state.event_code & ET_FLAG_START) != 0)
- dump_p = g_string_append_c(dump_p, '+');
+ g_string_append_c(dump_p, '+');
else if ((new_state.event_code & ET_FLAG_FINISH) != 0)
else if ((new_state.event_code & ET_FLAG_FINISH) != 0)
- dump_p = g_string_append_c(dump_p, '-');
+ g_string_append_c(dump_p, '-');
_DBG("value %s", dump_p->str);
int k = new_state.event_code & ~(ET_FLAG_START | ET_FLAG_FINISH);
if (k >= 0 && k < 32) {
_DBG("value %s", dump_p->str);
int k = new_state.event_code & ~(ET_FLAG_START | ET_FLAG_FINISH);
if (k >= 0 && k < 32) {
_DBG("value %s", dump_p->str);
g_free(temp);
} else {
_DBG("value %s", dump_p->str);
g_free(temp);
} else {
- dump_p = g_string_append(dump_p, "Ev");
+ g_string_append(dump_p, "Ev");
g_string_append_printf(dump_p, "%d", k);
_DBG("value %s", dump_p->str);
}
g_string_append_printf(dump_p, "%d", k);
_DBG("value %s", dump_p->str);
}
- dump_p = g_string_append_c(dump_p, '=');
+ g_string_append_c(dump_p, '=');
_DBG("value %s", dump_p->str);
if (chkin) {
g_string_append_printf(dump_p, "%d",
_DBG("value %s", dump_p->str);
if (chkin) {
g_string_append_printf(dump_p, "%d",
- dump_p = g_string_append(dump_p, "\n");
+ g_string_append(dump_p, "\n");
//: step details
old_state.state_1 = new_state.state_1;
old_state.state_2 = new_state.state_2;
//: step details
old_state.state_1 = new_state.state_1;
old_state.state_2 = new_state.state_2;
struct timeval tv;
gettimeofday(&tv, NULL);
struct timeval tv;
gettimeofday(&tv, NULL);
- dump_tmp_p = g_string_append(dump_tmp_p, TIZEN_DUMP_VERSION);
- dump_tmp_p = g_string_append_c(dump_tmp_p, ',');
- dump_tmp_p = g_string_append(dump_tmp_p, DUMP_DATA_TAG);
- dump_tmp_p = g_string_append_c(dump_tmp_p, ',');
+ g_string_append(dump_tmp_p, TIZEN_DUMP_VERSION);
+ g_string_append_c(dump_tmp_p, ',');
+ g_string_append(dump_tmp_p, DUMP_DATA_TAG);
+ g_string_append_c(dump_tmp_p, ',');
g_string_append_printf(dump_tmp_p, "%lld",
((long long)tv.tv_sec * 1000) + ((long long)tv.tv_usec / 1000) - old_state.time_s);
g_string_append_printf(dump_tmp_p, "%lld",
((long long)tv.tv_sec * 1000) + ((long long)tv.tv_usec / 1000) - old_state.time_s);
- dump_tmp_p = g_string_append(dump_tmp_p, "\n");
+ g_string_append(dump_tmp_p, "\n");
if (write(fd, dump_tmp_p->str, dump_tmp_p->len) < 0)
_WARN("write error");
if (write(fd, dump_tmp_p->str, dump_tmp_p->len) < 0)
_WARN("write error");
- if ((*error_code != BATTERY_MONITOR_ERROR_NONE) && appid_map_list != NULL) {
+ if ((*error_code != BATTERY_MONITOR_ERROR_NONE) && appid_map_list != NULL)
bm_set_free_gslist_appid_map(appid_map_list);
bm_set_free_gslist_appid_map(appid_map_list);
if ((*error_code == BATTERY_MONITOR_ERROR_NONE) && appid_map_list != NULL) {
_INFO("Returning appid map list");
return appid_map_list;
if ((*error_code == BATTERY_MONITOR_ERROR_NONE) && appid_map_list != NULL) {
_INFO("Returning appid map list");
return appid_map_list;