56 lines
2.0 KiB
Diff
56 lines
2.0 KiB
Diff
From 85a0e330d50c1546805c68cd621d1d85b5d08489 Mon Sep 17 00:00:00 2001
|
|
From: Kemeng Shi <shikemeng@huawei.com>
|
|
Date: Tue, 10 Aug 2021 11:13:06 +0800
|
|
Subject: [PATCH 44/50] etmem: cleancode
|
|
|
|
1. group_name for task_of_group and engine_of_group is defined as const, so add const
|
|
to group_name in function definition
|
|
2. pagesize in init_g_page_size is assigned with a value following init_g_page_size
|
|
assigned with initial value -1. Remove redundant initialization.
|
|
|
|
Signed-off-by: Kemeng Shi <shikemeng@huawei.com>
|
|
---
|
|
src/etmemd_src/etmemd_project.c | 5 +++--
|
|
src/etmemd_src/etmemd_scan.c | 2 +-
|
|
2 files changed, 4 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/etmemd_src/etmemd_project.c b/src/etmemd_src/etmemd_project.c
|
|
index decae76..53ef567 100644
|
|
--- a/src/etmemd_src/etmemd_project.c
|
|
+++ b/src/etmemd_src/etmemd_project.c
|
|
@@ -130,7 +130,8 @@ static enum opt_result project_of_group(GKeyFile *config, const char *group_name
|
|
return OPT_SUCCESS;
|
|
}
|
|
|
|
-static enum opt_result engine_of_group(GKeyFile *config, char *group_name, struct project *proj, struct engine **eng)
|
|
+static enum opt_result engine_of_group(GKeyFile *config, const char *group_name,
|
|
+ struct project *proj, struct engine **eng)
|
|
{
|
|
char *eng_name = NULL;
|
|
enum opt_result ret;
|
|
@@ -154,7 +155,7 @@ static enum opt_result engine_of_group(GKeyFile *config, char *group_name, struc
|
|
return OPT_SUCCESS;
|
|
}
|
|
|
|
-static enum opt_result task_of_group(GKeyFile *config, char *group_name,
|
|
+static enum opt_result task_of_group(GKeyFile *config, const char *group_name,
|
|
struct project *proj, struct engine *eng, struct task **tk)
|
|
{
|
|
char *task_name = NULL;
|
|
diff --git a/src/etmemd_src/etmemd_scan.c b/src/etmemd_src/etmemd_scan.c
|
|
index 3238668..0fb4fe6 100644
|
|
--- a/src/etmemd_src/etmemd_scan.c
|
|
+++ b/src/etmemd_src/etmemd_scan.c
|
|
@@ -70,7 +70,7 @@ static unsigned int get_page_shift(long pagesize)
|
|
int init_g_page_size(void)
|
|
{
|
|
unsigned int page_shift;
|
|
- long pagesize = -1;
|
|
+ long pagesize;
|
|
|
|
pagesize = sysconf(_SC_PAGESIZE);
|
|
if (pagesize == -1) {
|
|
--
|
|
2.27.0
|
|
|