X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Ftaint.c;h=08bdb6a799bb28729b7b68b8003fce8ead75976a;hb=9b58626a87f13d1835e56fccf65e98bcc248e107;hp=c655d60a61cf9009fae1043ee9833877625f2704;hpb=81579d9e9f994fb2908f50af41c3eb033d216e58;p=pspp diff --git a/src/libpspp/taint.c b/src/libpspp/taint.c index c655d60a61..08bdb6a799 100644 --- a/src/libpspp/taint.c +++ b/src/libpspp/taint.c @@ -37,7 +37,7 @@ /* A list of pointers to taint structures. */ struct taint_list { - size_t cnt; + size_t n; struct taint **taints; }; @@ -96,21 +96,21 @@ taint_clone (const struct taint *taint_) bool taint_destroy (struct taint *taint) { - if ( taint ) + if (taint) { bool was_tainted = taint_is_tainted (taint); if (--taint->ref_cnt == 0) { size_t i, j; - for (i = 0; i < taint->predecessors.cnt; i++) - for (j = 0; j < taint->successors.cnt; j++) + for (i = 0; i < taint->predecessors.n; i++) + for (j = 0; j < taint->successors.n; j++) taint_propagate (taint->predecessors.taints[i], taint->successors.taints[j]); - for (i = 0; i < taint->predecessors.cnt; i++) + for (i = 0; i < taint->predecessors.n; i++) taint_list_remove (&taint->predecessors.taints[i]->successors, taint); - for (i = 0; i < taint->successors.cnt; i++) + for (i = 0; i < taint->successors.n; i++) taint_list_remove (&taint->successors.taints[i]->predecessors, taint); taint_list_destroy (&taint->successors); @@ -193,7 +193,7 @@ taint_reset_successor_taint (const struct taint *taint_) { size_t i; - for (i = 0; i < taint->successors.cnt; i++) + for (i = 0; i < taint->successors.n; i++) if (taint->successors.taints[i]->tainted_successor) return; @@ -205,7 +205,7 @@ taint_reset_successor_taint (const struct taint *taint_) static void taint_list_init (struct taint_list *list) { - list->cnt = 0; + list->n = 0; list->taints = NULL; } @@ -222,7 +222,7 @@ taint_list_contains (const struct taint_list *list, const struct taint *taint) { size_t i; - for (i = 0; i < list->cnt; i++) + for (i = 0; i < list->n; i++) if (list->taints[i] == taint) return true; @@ -247,11 +247,11 @@ taint_list_add (struct taint_list *list, struct taint *taint) list capacity is always zero or a power of 2. Thus, if the list count is one of these threshold values, we need to allocate more memory. */ - if (is_zero_or_power_of_2 (list->cnt)) + if (is_zero_or_power_of_2 (list->n)) list->taints = xnrealloc (list->taints, - list->cnt == 0 ? 1 : 2 * list->cnt, + list->n == 0 ? 1 : 2 * list->n, sizeof *list->taints); - list->taints[list->cnt++] = taint; + list->taints[list->n++] = taint; } } @@ -261,11 +261,11 @@ taint_list_remove (struct taint_list *list, const struct taint *taint) { size_t i; - for (i = 0; i < list->cnt; i++) + for (i = 0; i < list->n; i++) if (list->taints[i] == taint) { - remove_element (list->taints, list->cnt, sizeof *list->taints, i); - list->cnt--; + remove_element (list->taints, list->n, sizeof *list->taints, i); + list->n--; return; } @@ -281,13 +281,13 @@ recursively_set_taint (struct taint *taint) size_t i; taint->tainted = taint->tainted_successor = true; - for (i = 0; i < taint->successors.cnt; i++) + for (i = 0; i < taint->successors.n; i++) { struct taint *s = taint->successors.taints[i]; if (!s->tainted) recursively_set_taint (s); } - for (i = 0; i < taint->predecessors.cnt; i++) + for (i = 0; i < taint->predecessors.n; i++) { struct taint *p = taint->predecessors.taints[i]; if (!p->tainted_successor) @@ -303,7 +303,7 @@ recursively_set_tainted_successor (struct taint *taint) size_t i; taint->tainted_successor = true; - for (i = 0; i < taint->predecessors.cnt; i++) + for (i = 0; i < taint->predecessors.n; i++) { struct taint *p = taint->predecessors.taints[i]; if (!p->tainted_successor)