Snippets

TeamCOINSE CAVM/Anti-patterns

Updated by JUNHWI KIM

File case2.c Added

  • Ignore whitespace
  • Hide word diff
+typedef struct _data {
+  int* internal;
+  int a, b;
+  struct _data* next;
+} Data;
+
+void case2(Data* d) {
+  if (d == 0 || d->internal == 0) return;
+
+  if (d->a == 1 && d->b == 2) {
+    return;
+  } else {
+    return;
+  }
+}

File case3.c Added

  • Ignore whitespace
  • Hide word diff
+void case3(int a) {
+  int b = 10;
+  if (a == b) {
+    return;
+  } else {
+    return;
+  }
+}

File case4.c Added

  • Ignore whitespace
  • Hide word diff
+#include <string.h>
+void case4(char* str) {
+  if (strcmp(str, "Hello") == 0) {
+    return;
+  } else {
+    return;
+  }
+}

File case5.c Added

  • Ignore whitespace
  • Hide word diff
+int _5() { return 10; }
+void case5(int a) {
+  if (a == _5()) {
+    return;
+  } else {
+    return;
+  }
+}

File case6.c Added

  • Ignore whitespace
  • Hide word diff
+typedef struct _data {
+  int* internal;
+  int a, b;
+  struct _data* next;
+} Data;
+
+void case6(Data *d) {
+  Data *d_in;
+  d_in = d->next;
+  if (d_in->a == 2) {
+    return;
+  } else {
+    return;
+  }
+}
Created by JUNHWI KIM

File case1.c Added

  • Ignore whitespace
  • Hide word diff
+void case1(int a, int b, int c) {
+  if (a > 0 && b > 0 && c > 0) {
+    if (a + b == c * c) {
+      return;
+    } else {
+      return;
+    }
+  } else {
+    return;
+  }
+}