aboutsummaryrefslogtreecommitdiffstats
path: root/lcc/src/list.c
diff options
context:
space:
mode:
authorzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-26 17:39:27 +0000
committerzakk <zakk@edf5b092-35ff-0310-97b2-ce42778d08ea>2005-08-26 17:39:27 +0000
commit6bf20c78f5b69d40bcc4931df93d29198435ab67 (patch)
treee3eda937a05d7db42de725b7013bd0344b987f34 /lcc/src/list.c
parent872d4d7f55af706737ffb361bb76ad13e7496770 (diff)
downloadioquake3-aero-6bf20c78f5b69d40bcc4931df93d29198435ab67.tar.gz
ioquake3-aero-6bf20c78f5b69d40bcc4931df93d29198435ab67.zip
newlines fixed
git-svn-id: svn://svn.icculus.org/quake3/trunk@6 edf5b092-35ff-0310-97b2-ce42778d08ea
Diffstat (limited to 'lcc/src/list.c')
-rwxr-xr-xlcc/src/list.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/lcc/src/list.c b/lcc/src/list.c
index dbd63ed..29e660a 100755
--- a/lcc/src/list.c
+++ b/lcc/src/list.c
@@ -1,56 +1,56 @@
-#include "c.h"
-
-
-static List freenodes; /* free list nodes */
-
-/* append - append x to list, return new list */
-List append(void *x, List list) {
- List new;
-
- if ((new = freenodes) != NULL)
- freenodes = freenodes->link;
- else
- NEW(new, PERM);
- if (list) {
- new->link = list->link;
- list->link = new;
- } else
- new->link = new;
- new->x = x;
- return new;
-}
-
-/* length - # elements in list */
-int length(List list) {
- int n = 0;
-
- if (list) {
- List lp = list;
- do
- n++;
- while ((lp = lp->link) != list);
- }
- return n;
-}
-
-/* ltov - convert list to an NULL-terminated vector allocated in arena */
-void *ltov(List *list, unsigned arena) {
- int i = 0;
- void **array = newarray(length(*list) + 1, sizeof array[0], arena);
-
- if (*list) {
- List lp = *list;
- do {
- lp = lp->link;
- array[i++] = lp->x;
- } while (lp != *list);
-#ifndef PURIFY
- lp = (*list)->link;
- (*list)->link = freenodes;
- freenodes = lp;
-#endif
- }
- *list = NULL;
- array[i] = NULL;
- return array;
-}
+#include "c.h"
+
+
+static List freenodes; /* free list nodes */
+
+/* append - append x to list, return new list */
+List append(void *x, List list) {
+ List new;
+
+ if ((new = freenodes) != NULL)
+ freenodes = freenodes->link;
+ else
+ NEW(new, PERM);
+ if (list) {
+ new->link = list->link;
+ list->link = new;
+ } else
+ new->link = new;
+ new->x = x;
+ return new;
+}
+
+/* length - # elements in list */
+int length(List list) {
+ int n = 0;
+
+ if (list) {
+ List lp = list;
+ do
+ n++;
+ while ((lp = lp->link) != list);
+ }
+ return n;
+}
+
+/* ltov - convert list to an NULL-terminated vector allocated in arena */
+void *ltov(List *list, unsigned arena) {
+ int i = 0;
+ void **array = newarray(length(*list) + 1, sizeof array[0], arena);
+
+ if (*list) {
+ List lp = *list;
+ do {
+ lp = lp->link;
+ array[i++] = lp->x;
+ } while (lp != *list);
+#ifndef PURIFY
+ lp = (*list)->link;
+ (*list)->link = freenodes;
+ freenodes = lp;
+#endif
+ }
+ *list = NULL;
+ array[i] = NULL;
+ return array;
+}