[tracker/collation-gconf-locale: 18/20] libtracker-common, miner-applications: Improve check for empty string



commit c14acd45d7dd34b5dd13841ec2815a7e7ff0829c
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Tue Nov 30 17:42:31 2010 +0100

    libtracker-common, miner-applications: Improve check for empty string

 src/libtracker-common/tracker-locale.c            |    2 +-
 src/miners/fs/tracker-miner-applications-locale.c |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/src/libtracker-common/tracker-locale.c b/src/libtracker-common/tracker-locale.c
index 7e3d06e..bac82ce 100644
--- a/src/libtracker-common/tracker-locale.c
+++ b/src/libtracker-common/tracker-locale.c
@@ -186,7 +186,7 @@ locale_gconf_notify_cb (GConfClient *client,
 
 	/* String must have a length > 0 */
 	if (!string_value ||
-	    strlen (string_value) == 0) {
+	    string_value[0] == '\0') {
 		g_warning ("Locale value for '%s' must not be empty, not changing %s",
 		           gconf_locales[i],
 		           locale_names[i]);
diff --git a/src/miners/fs/tracker-miner-applications-locale.c b/src/miners/fs/tracker-miner-applications-locale.c
index 39c537c..65916eb 100644
--- a/src/miners/fs/tracker-miner-applications-locale.c
+++ b/src/miners/fs/tracker-miner-applications-locale.c
@@ -39,7 +39,8 @@ miner_applications_locale_get_previous (const gchar *locale_file)
 
 		/* Check locale is correct */
 		if (G_LIKELY (g_file_get_contents (locale_file, &contents, NULL, NULL))) {
-			if (contents && strlen (contents) == 0) {
+			if (contents &&
+			    contents[0] == '\0') {
 				g_critical ("  Empty locale file found at '%s'", locale_file);
 				g_free (contents);
 			} else {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]