feedback: Remove changed data from feedback_data 84/302784/1
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 7 Dec 2023 05:58:14 +0000 (14:58 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Tue, 12 Dec 2023 08:02:34 +0000 (17:02 +0900)
In the feedback_data structure, there is unreachable char* changed data.
From b27c0d29aff919b34ec17a59411fff789aa6017e commit, set_path became unavailable.
As set_path became unreachable, changed data is also not used.
Since the changed data unnecessarily occupies as much memory as the number of patterns,
it should be deleted.

Change-Id: I17a266754a51f8c8061978a3b2d9c349de6c6abc
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/feedback-config.c
src/feedback-config.h
src/sound.c

index 6964755..fd99cda 100644 (file)
@@ -108,10 +108,6 @@ void feedback_free_config(struct feedback_config_info *info)
                        free(info->data[i].origin);
                        info->data[i].origin = NULL;
                }
-               if (info->data[i].changed) {
-                       free(info->data[i].changed);
-                       info->data[i].changed = NULL;
-               }
        }
 
        free(info->data);
index 97cdd65..d5a7143 100644 (file)
@@ -21,7 +21,6 @@
 struct feedback_data {
        int pattern;
        char *origin;
-       char *changed;
 };
 
 struct feedback_config_info {
index 6dfa7f7..e9fdd59 100644 (file)
@@ -81,9 +81,7 @@ static char *get_data(feedback_pattern_e pattern)
                return NULL;
        }
 
-       if (sound_info->data[index].changed)
-               data = sound_info->data[index].changed;
-       else
+       if (sound_info->data[index].origin)
                data = sound_info->data[index].origin;
 
        return data;
@@ -464,10 +462,6 @@ static int sound_set_path(feedback_pattern_e pattern, char *path)
                                continue;
 
                        sound_info->data[i].pattern = pattern;
-                       if (path)
-                               sound_info->data[i].changed = strdup(path);
-                       else
-                               sound_info->data[i].changed = NULL;
 
                        _D("The file of pattern(%s) is changed to [%s]",
                                        profile->str_pattern(pattern), path? path:"NULL");
@@ -478,15 +472,6 @@ static int sound_set_path(feedback_pattern_e pattern, char *path)
                return -EPERM;
        }
 
-       if (sound_info->data[index].changed) {
-               free(sound_info->data[index].changed);
-               sound_info->data[index].changed = NULL;
-       }
-
-       /* if path is NULL, this pattern set to default file */
-       if (path)
-               sound_info->data[index].changed = strdup(path);
-
        _D("The file of pattern(%s) is changed to [%s]",
                        profile->str_pattern(pattern), path);
        return 0;