comparison table.c @ 2:ec2f8f6f1dc9

Cleanup pass #1: Get rid of some ancient K&R-isms.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 24 Feb 2015 20:28:57 +0200
parents 4410c9c7750d
children a2a81589380d
comparison
equal deleted inserted replaced
1:cfcae2ef1c2b 2:ec2f8f6f1dc9
35 #include <stdlib.h> 35 #include <stdlib.h>
36 #include "proto.h" 36 #include "proto.h"
37 37
38 static unsigned int firstunused = 0; 38 static unsigned int firstunused = 0;
39 39
40 #ifndef __STDC__ 40
41 table *
42 FindNextEntryType (entry, andmask, eormask)
43 table *entry;
44 unsigned char andmask;
45 unsigned char eormask;
46 #else
47 table *FindNextEntryType (table *entry, unsigned char andmask, 41 table *FindNextEntryType (table *entry, unsigned char andmask,
48 unsigned char eormask) 42 unsigned char eormask)
49 #endif
50 { 43 {
51 if (!scantable) return NULL; 44 if (!scantable) return NULL;
52 45
53 if (!entry || entry >= &scantable[entrycount]) 46 if (!entry || entry >= &scantable[entrycount])
54 entry = scantable; 47 entry = scantable;
60 return entry; 53 return entry;
61 54
62 return NULL; 55 return NULL;
63 } 56 }
64 57
65 #ifndef __STDC__ 58
66 table *
67 FindNextEntryTypeParent (entry, parent, andmask, eormask)
68 table *entry;
69 ADDR_T parent;
70 unsigned char andmask;
71 unsigned char eormask;
72 #else
73 table *FindNextEntryTypeParent (table *entry, ADDR_T parent, 59 table *FindNextEntryTypeParent (table *entry, ADDR_T parent,
74 unsigned char andmask, unsigned char eormask) 60 unsigned char andmask, unsigned char eormask)
75 #endif
76 { 61 {
77 if (!scantable) return NULL; 62 if (!scantable) return NULL;
78 63
79 64
80 if (!entry || entry >= &scantable[entrycount]) 65 if (!entry || entry >= &scantable[entrycount])
88 return entry; 73 return entry;
89 74
90 return NULL; 75 return NULL;
91 } 76 }
92 77
93 #ifndef __STDC__ 78
94 table *
95 FindNextEntry (entry, address, andmask, eormask)
96 table *entry;
97 ADDR_T address;
98 unsigned char andmask;
99 unsigned char eormask;
100 #else
101 table *FindNextEntry (table *entry, ADDR_T address, 79 table *FindNextEntry (table *entry, ADDR_T address,
102 unsigned char andmask, unsigned char eormask) 80 unsigned char andmask, unsigned char eormask)
103 #endif
104 { 81 {
105 if (!scantable) return NULL; 82 if (!scantable) return NULL;
106 83
107 if (!entry || entry >= &scantable[entrycount]) 84 if (!entry || entry >= &scantable[entrycount])
108 entry = scantable; 85 entry = scantable;
115 return entry; 92 return entry;
116 93
117 return NULL; 94 return NULL;
118 } 95 }
119 96
120 #ifndef __STDC__ 97
121 void
122 AddEntry (address, parent, type)
123 ADDR_T address;
124 ADDR_T parent;
125 unsigned char type;
126 #else
127 void AddEntry (ADDR_T address, ADDR_T parent, unsigned char type) 98 void AddEntry (ADDR_T address, ADDR_T parent, unsigned char type)
128 #endif
129 { 99 {
130 if (firstunused < entrycount) { 100 if (firstunused < entrycount) {
131 scantable[firstunused].address = address; 101 scantable[firstunused].address = address;
132 scantable[firstunused].parent = parent; 102 scantable[firstunused].parent = parent;
133 scantable[firstunused].type = type; 103 scantable[firstunused].type = type;
145 115
146 firstunused = ++entrycount; 116 firstunused = ++entrycount;
147 } 117 }
148 } 118 }
149 119
150 #ifndef __STDC__ 120
151 void
152 DeleteEntry (entry)
153 table *entry;
154 #else
155 void DeleteEntry (table *entry) 121 void DeleteEntry (table *entry)
156 #endif
157 { 122 {
158 entry -> type = TBL_DELETED; 123 entry -> type = TBL_DELETED;
159 124
160 if (firstunused > entry - scantable) 125 if (firstunused > entry - scantable)
161 firstunused = entry - scantable; 126 firstunused = entry - scantable;