init_db: Add fallback for matching previous style feature 46/315246/2 accepted/tizen_unified_dev accepted/tizen/unified/20240801.150145 accepted/tizen/unified/dev/20240805.054249 accepted/tizen/unified/toolchain/20240812.133227 accepted/tizen/unified/x/20240802.020223 accepted/tizen/unified/x/asan/20240813.231620
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 29 Jul 2024 04:12:19 +0000 (13:12 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 29 Jul 2024 04:17:48 +0000 (13:17 +0900)
The commit 114901968a5bb35d104feca8dc4baf5b167828e3 has changed feature
matching style. However, there are features that haven't been changed to
the latest style. Therefore it also supports matching the previous style
feature.

Change-Id: I6464f980ec6c0f2ac1900ac319ece25636b0e06d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/init_db/system_info_db_init.c

index d03600f0cefd5f69a0fc28076879604ff5065429..c02958fcace60a055411c6b4e5b231bfbcd20798 100644 (file)
@@ -355,7 +355,14 @@ static int system_info_get_values_config_xml(const char *db_path, const char *pa
                                continue;
                        }
 
-                       value = (char *)xmlGetProp(cur_node, (const xmlChar*)"value");
+                       /**
+                        * Match the latest style first
+                        *  : <key name="tizen.org/feature/foo" type="bool" value="false"/>
+                        * and if it fails to match, do fallback. Match the old style
+                        *  : <key name="tizen.org/feature/foo" type="bool">false</key>
+                        */
+                       value = (char *)xmlGetProp(cur_node, (const xmlChar*)"value") ? :
+                               (char *)xmlNodeListGetString(doc, cur_node->xmlChildrenNode, 1);
                        if (!value) {
                                xmlFree(name);
                                xmlFree(type);