[evolution-data-server] Simplify camel_imapx_stream_atom().



commit 3a47f3c0ec58bba37b00ec81e907f1fca7327445
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Jul 14 08:15:05 2013 -0400

    Simplify camel_imapx_stream_atom().

 camel/camel-imapx-stream.c |   41 ++++++++++++++++++++++-------------------
 1 files changed, 22 insertions(+), 19 deletions(-)
---
diff --git a/camel/camel-imapx-stream.c b/camel/camel-imapx-stream.c
index 485c1ea..6900d17 100644
--- a/camel/camel-imapx-stream.c
+++ b/camel/camel-imapx-stream.c
@@ -386,32 +386,35 @@ camel_imapx_stream_atom (CamelIMAPXStream *is,
                          GCancellable *cancellable,
                          GError **error)
 {
+       camel_imapx_token_t tok;
        guchar *p, c;
-       GError *local_error = NULL;
 
        g_return_val_if_fail (CAMEL_IS_IMAPX_STREAM (is), IMAPX_TOK_ERROR);
        g_return_val_if_fail (data != NULL, IMAPX_TOK_ERROR);
        g_return_val_if_fail (lenp != NULL, IMAPX_TOK_ERROR);
 
        /* this is only 'approximate' atom */
-       switch (camel_imapx_stream_token (is, data, lenp, cancellable, &local_error)) {
-       case IMAPX_TOK_TOKEN:
-               p = *data;
-               while ((c = *p))
-                       *p++ = toupper(c);
-       case IMAPX_TOK_INT:
-               return 0;
-       case IMAPX_TOK_ERROR:
-               if (local_error != NULL)
-                       g_propagate_error (error, local_error);
-               return IMAPX_TOK_ERROR;
-       default:
-               if (local_error == NULL)
-                       g_set_error (error, CAMEL_IMAPX_ERROR, 1, "expecting atom");
-               else
-                       g_propagate_error (error, local_error);
-               io (is->tagprefix, "expecting atom!\n");
-               return IMAPX_TOK_ERROR;
+       tok = camel_imapx_stream_token (is, data, lenp, cancellable, error);
+
+       switch (tok) {
+               case IMAPX_TOK_ERROR:
+                       return IMAPX_TOK_ERROR;
+
+               case IMAPX_TOK_TOKEN:
+                       p = *data;
+                       while ((c = *p))
+                               *p++ = toupper(c);
+                       return 0;
+
+               case IMAPX_TOK_INT:
+                       return 0;
+
+               default:
+                       g_set_error (
+                               error, CAMEL_IMAPX_ERROR, 1,
+                               "expecting atom");
+                       io (is->tagprefix, "expecting atom!\n");
+                       return IMAPX_TOK_ERROR;
        }
 }
 


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