[accounts-dialog] No need for doing things backwards



commit 690723a5dfc106a9cd45cc4d03db786653fefc74
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Feb 4 15:22:32 2010 -0500

    No need for doing things backwards
    
    Replace all uses of g_strrstr with strstr.

 src/run-passwd.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/src/run-passwd.c b/src/run-passwd.c
index 479ca1b..0a5419b 100644
--- a/src/run-passwd.c
+++ b/src/run-passwd.c
@@ -344,7 +344,7 @@ is_string_complete (gchar *str, ...)
         va_start (ap, str);
 
         while ((arg = va_arg (ap, char *)) != NULL) {
-                if (g_strrstr (str, arg) != NULL) {
+                if (strstr (str, arg) != NULL) {
                         va_end (ap);
                         return TRUE;
                 }
@@ -393,7 +393,7 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
 
                         if (is_string_complete (str->str, "assword: ", "failure", "wrong", "error", NULL)) {
 
-                                if (g_strrstr (str->str, "assword: ") != NULL) {
+                                if (strstr (str->str, "assword: ") != NULL) {
                                         /* Authentication successful */
 
                                         passwd_handler->backend_state = PASSWD_STATE_NEW;
@@ -461,7 +461,7 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
                                                 "failure",
                                                 NULL)) {
 
-                                if (g_strrstr (str->str, "successfully") != NULL) {
+                                if (strstr (str->str, "successfully") != NULL) {
                                         /* Hooray! */
 
                                         /* Trigger callback to update status */
@@ -473,32 +473,32 @@ io_watch_stdout (GIOChannel *source, GIOCondition condition, PasswdHandler *pass
                                 else {
                                         /* Ohnoes! */
 
-                                        if (g_strrstr (str->str, "recovered") != NULL) {
+                                        if (strstr (str->str, "recovered") != NULL) {
                                                 /* What does this indicate?
                                                  * "Authentication information cannot be recovered?" from libpam? */
                                                 error = g_error_new_literal (PASSWD_ERROR, PASSWD_ERROR_UNKNOWN,
                                                                              str->str);
-                                        } else if (g_strrstr (str->str, "short") != NULL ||
-                                                   g_strrstr (str->str, "longer") != NULL) {
+                                        } else if (strstr (str->str, "short") != NULL ||
+                                                   strstr (str->str, "longer") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The new password is too short"));
-                                        } else if (g_strrstr (str->str, "palindrome") != NULL ||
-                                                   g_strrstr (str->str, "simple") != NULL ||
-                                                   g_strrstr (str->str, "dictionary") != NULL) {
+                                        } else if (strstr (str->str, "palindrome") != NULL ||
+                                                   strstr (str->str, "simple") != NULL ||
+                                                   strstr (str->str, "dictionary") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The new password is too simple"));
-                                        } else if (g_strrstr (str->str, "similar") != NULL ||
-                                                   g_strrstr (str->str, "wrapped") != NULL) {
+                                        } else if (strstr (str->str, "similar") != NULL ||
+                                                   strstr (str->str, "wrapped") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The old and new passwords are too similar"));
-                                        } else if (g_strrstr (str->str, "1 numeric or special") != NULL) {
+                                        } else if (strstr (str->str, "1 numeric or special") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The new password must contain numeric or special characters"));
-                                        } else if (g_strrstr (str->str, "unchanged") != NULL ||
-                                                   g_strrstr (str->str, "match") != NULL) {
+                                        } else if (strstr (str->str, "unchanged") != NULL ||
+                                                   strstr (str->str, "match") != NULL) {
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_REJECTED,
                                                                      _("The old and new passwords are the same"));
-                                        } else if (g_strrstr (str->str, "failure") != NULL) {
+                                        } else if (strstr (str->str, "failure") != NULL) {
                                                 /* Authentication failure */
                                                 error = g_error_new (PASSWD_ERROR, PASSWD_ERROR_AUTH_FAILED,
                                                                      _("Your password has been changed since you initially authenticated!"));



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