feedback: Remove changed data from feedback_data 34/303334/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, 26 Dec 2023 02:16:23 +0000 (11:16 +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 6964755a95994881ce7684978a1fe946df2595c0..fd99cda7505ed2e500c06cf7c13149177448c80d 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 97cdd659b4e87049a54bda1ac9f5733fb8cc4232..d5a714314e6ba3c3756a24f28550aae2b0d47d58 100644 (file)
@@ -21,7 +21,6 @@
 struct feedback_data {
        int pattern;
        char *origin;
-       char *changed;
 };
 
 struct feedback_config_info {
index 1f6d33da146cf86f39fba948f86ec61ca760789e..b620a989f57d64e4684c63f2e40e842a1b7eb828 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;
@@ -472,10 +470,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");
@@ -486,15 +480,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;