Hi!

I would like to propose a refactoring of the bio_bucket_ctrl() function in the
ssl_bucket.c file:

- Return values from case statements and get rid of the ret variable. The
control flow is more explicit and clear.

- Move the default statement to the end of the switch. It's more common for
switch statements.

What do you think?

Kind Regards,
Denis Kovalchuk
Refactoring of the bio_bucket_ctrl() function.

* buckets/ssl_buckets.c
  (bio_bucket_ctrl):
  - Return values from case statements and get rid of the ret variable. The
    control flow is more explicit and clear.
  - Move the default statement to the end of the switch. It's more common for
    switch statements.

Index: buckets/ssl_buckets.c
===================================================================
--- buckets/ssl_buckets.c       (revision 1902009)
+++ buckets/ssl_buckets.c       (working copy)
@@ -506,21 +506,17 @@ static int bio_bucket_destroy(BIO *bio)
 
 static long bio_bucket_ctrl(BIO *bio, int cmd, long num, void *ptr)
 {
-    long ret = 1;
-
     switch (cmd) {
-    default:
-        /* abort(); */
-        break;
     case BIO_CTRL_FLUSH:
         /* At this point we can't force a flush. */
-        break;
+        return 1;
     case BIO_CTRL_PUSH:
     case BIO_CTRL_POP:
-        ret = 0;
-        break;
+        return 0;
+    default:
+        /* abort(); */
+        return 1;
     }
-    return ret;
 }
 
 #ifdef SERF_NO_SSL_BIO_WRAPPERS

Reply via email to