summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/stats.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/stats.c b/src/stats.c
index 7d05b893..a4fcc9ea 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -201,19 +201,6 @@ static void stats_free(gpointer user_data)
g_free(file);
}
-static int stats_create(struct connman_service *service)
-{
- struct stats_file *file;
-
- file = g_try_new0(struct stats_file, 1);
- if (file == NULL)
- return -ENOMEM;
-
- g_hash_table_insert(stats_hash, service, file);
-
- return 0;
-}
-
static void update_first(struct stats_file *file)
{
file->first = (struct stats_record *)
@@ -362,12 +349,11 @@ int __connman_stats_service_register(struct connman_service *service)
file = g_hash_table_lookup(stats_hash, service);
if (file == NULL) {
- err = stats_create(service);
-
- if (err < 0)
- return err;
+ file = g_try_new0(struct stats_file, 1);
+ if (file == NULL)
+ return -ENOMEM;
- file = g_hash_table_lookup(stats_hash, service);
+ g_hash_table_insert(stats_hash, service, file);
} else {
return -EALREADY;
}