aboutsummaryrefslogtreecommitdiff
path: root/src/target.c
diff options
context:
space:
mode:
authorGareth McMullin2012-06-24 16:53:13 +1200
committerGareth McMullin2012-06-24 19:08:49 +1200
commita16123997b77a5d3a137fcd80e6bf4134b7a4a23 (patch)
treefdef5d9e21fca06a0b9d06764d4c8545d78842f4 /src/target.c
parent8872315e82c6ab92864020f2a05490c5f6df91cd (diff)
Added target.c for common target routines.
Diffstat (limited to 'src/target.c')
-rw-r--r--src/target.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/target.c b/src/target.c
new file mode 100644
index 0000000..1c70340
--- /dev/null
+++ b/src/target.c
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the Black Magic Debug project.
+ *
+ * Copyright (C) 2012 Black Sphere Technologies Ltd.
+ * Written by Gareth McMullin <gareth@blacksphere.co.nz>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "general.h"
+#include "target.h"
+
+#include <stdlib.h>
+
+target *target_list = NULL;
+target *cur_target = NULL;
+target *last_target = NULL;
+
+target *target_new(unsigned size)
+{
+ target *t = (void*)calloc(1, size);
+ t->next = target_list;
+ target_list = t;
+
+ return t;
+}
+
+void target_list_free(void)
+{
+ while(target_list) {
+ target *t = target_list->next;
+ free(target_list);
+ target_list = t;
+ }
+ last_target = cur_target = NULL;
+}
+