enumeration autoincrement: use if/else logic
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Jul 2016 22:46:16 +0000 (18:46 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 Jul 2016 22:46:16 +0000 (18:46 -0400)
Use if/else logic rather than "continue" on loop for clarity.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-events.c

index a706cbdb4d5ff2e12557f8c4a729243ebe79362e..455b790f45fbe06dd37da01b7b79be7477f77df5 100644 (file)
@@ -1963,36 +1963,38 @@ int _lttng_enum_statedump(struct lttng_session *session,
                        ret = lttng_metadata_printf(session, ",\n");
                        if (ret)
                                goto end;
-                       continue;
-               }
-
-               ret = lttng_metadata_printf(session,
-                               " = ");
-               if (ret)
-                       goto end;
-               if (entry->start.signedness)
-                       ret = lttng_metadata_printf(session,
-                               "%lld", (long long) entry->start.value);
-               else
-                       ret = lttng_metadata_printf(session,
-                               "%llu", entry->start.value);
-               if (ret)
-                       goto end;
-               if (entry->start.signedness == entry->end.signedness &&
-                               entry->start.value == entry->end.value) {
-                       ret = lttng_metadata_printf(session,
-                               ",\n");
                } else {
-                       if (entry->end.signedness) {
+                       ret = lttng_metadata_printf(session,
+                                       " = ");
+                       if (ret)
+                               goto end;
+                       if (entry->start.signedness)
                                ret = lttng_metadata_printf(session,
-                                       " ... %lld,\n", (long long) entry->end.value);
-                       } else {
+                                       "%lld", (long long) entry->start.value);
+                       else
+                               ret = lttng_metadata_printf(session,
+                                       "%llu", entry->start.value);
+                       if (ret)
+                               goto end;
+                       if (entry->start.signedness == entry->end.signedness &&
+                                       entry->start.value
+                                               == entry->end.value) {
                                ret = lttng_metadata_printf(session,
-                                       " ... %llu,\n", entry->end.value);
+                                       ",\n");
+                       } else {
+                               if (entry->end.signedness) {
+                                       ret = lttng_metadata_printf(session,
+                                               " ... %lld,\n",
+                                               (long long) entry->end.value);
+                               } else {
+                                       ret = lttng_metadata_printf(session,
+                                               " ... %llu,\n",
+                                               entry->end.value);
+                               }
                        }
+                       if (ret)
+                               goto end;
                }
-               if (ret)
-                       goto end;
        }
        ret = print_tabs(session, nesting);
        if (ret)
This page took 0.027527 seconds and 4 git commands to generate.