From: MyungJoo Ham Date: Fri, 14 Jun 2019 02:18:06 +0000 (+0900) Subject: [Conf] If CONFFILE path is not available, use the default X-Git-Tag: accepted/tizen/unified/20190717.115101~23 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8389b69fbaaed8238ccb35435f9f419c385f37f8;p=platform%2Fupstream%2Fnnstreamer.git [Conf] If CONFFILE path is not available, use the default If conffile path is not available in envvar, use the default. We had this feature before and... somehow, this feature has been removed at some point. I'm reviving this feature as this makes errors in some systems. I've added g_assert to avoid similar errors without detected at the point of failure. Signed-off-by: MyungJoo Ham --- diff --git a/gst/nnstreamer/nnstreamer_conf.c b/gst/nnstreamer/nnstreamer_conf.c index 2d6add9..acdb3f5 100644 --- a/gst/nnstreamer/nnstreamer_conf.c +++ b/gst/nnstreamer/nnstreamer_conf.c @@ -274,6 +274,12 @@ nnsconf_loadconf (gboolean force_reload) conf.conffile = _strdup_getenv (NNSTREAMER_ENVVAR_CONF_FILE); } + if (conf.conffile == NULL) + conf.conffile = g_strdup (NNSTREAMER_DEFAULT_CONF_FILE); + + g_assert (key_file != NULL); + g_assert (conf.conffile != NULL); + /* Read the conf file. It's ok even if we cannot load it. */ if (g_key_file_load_from_file (key_file, conf.conffile, G_KEY_FILE_NONE, NULL)) { @@ -468,6 +474,8 @@ nnsconf_get_custom_value_string (const gchar * group, const gchar * key) if (NULL == value && conf.conffile) { g_autoptr (GKeyFile) key_file = g_key_file_new (); + g_assert (key_file != NULL); + if (g_key_file_load_from_file (key_file, conf.conffile, G_KEY_FILE_NONE, NULL)) { value = g_key_file_get_string (key_file, group, key, NULL);