aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/health/list.c
diff options
context:
space:
mode:
authorblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
committerblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
commitca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch)
tree50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/health/list.c
parent43668d9109b1f36329646fd07324d435be6f0050 (diff)
downloadcompcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz
compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.) rapportCompcert_all.txt liste les erreurs produites par ccomp. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/health/list.c')
-rw-r--r--test/ccured_olden/health/list.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/test/ccured_olden/health/list.c b/test/ccured_olden/health/list.c
new file mode 100644
index 00000000..dcd268cc
--- /dev/null
+++ b/test/ccured_olden/health/list.c
@@ -0,0 +1,55 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/********************************************************************
+ * List.c: Handles lists. *
+ * To be used with health.c *
+ ******************************************************************* */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "health.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+void addList(struct List *list, struct Patient *patient) {
+ struct List *b;
+
+ while (list != NULL)
+ {
+ b = list;
+ list = list->forward;
+ }
+
+ list = (struct List *)mymalloc(sizeof(struct List));
+ list->patient = patient;
+ list->forward = NULL;
+ list->back = b;
+ b->forward = list;
+}
+
+
+void removeList(struct List *list, struct Patient *patient)
+{
+ struct List *l1,*l2;
+ struct Patient *p;
+
+ p = list->patient;
+ while(p != patient)
+ {
+ list = list->forward;
+ p = list->patient;
+ }
+
+ l1 = list->back;
+ l2 = list->forward;
+ l1->forward = l2;
+ if (list->forward != NULL)
+ {
+ l1 = list->forward;
+ l2 = list->back;
+ l1->back = l2;
+ }
+}
+