Skip to content

Commit 213a2e3

Browse files
committed
enum: Fix compiler warnings in older distros (C90 warnings!)
Signed-off-by: andypugh <andy@bodgesoc.org>
1 parent 5d033a8 commit 213a2e3

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/hal/components/enum.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1616
//
1717

18-
/* A configurable component to use Mesa PktUART for modbus control */
19-
18+
// Convert bit pins to enumerated ints and vice-versa
2019

2120
#include "rtapi.h"
2221
#include "rtapi_slab.h"
@@ -179,26 +178,28 @@ int rtapi_app_main(void){
179178
return 0;
180179

181180
fail0:
182-
free(e.insts);
181+
rtapi_kfree(e.insts);
183182
hal_exit(comp_id);
184183
return -1;
185184

186185
}
187186

188-
static void decode(void *v_inst, long period){;
187+
static void decode(void *v_inst, long period){
188+
int i;
189189
enum_inst_t *inst = v_inst;
190-
for (int i = 1; i <= inst->num_pins; i++){
190+
for (i = 1; i <= inst->num_pins; i++){
191191
if (*(inst->hal[0].en) == *(inst->hal[i].en)){
192192
*(inst->hal[i].bit) = 1;
193193
} else {
194194
*(inst->hal[i].bit) = 0;
195195
}
196196
}
197197
}
198-
static void encode(void *v_inst, long period){;
198+
static void encode(void *v_inst, long period){
199+
int i;
199200
enum_inst_t *inst = v_inst;
200201
*(inst->hal[0].en) = 0;
201-
for (int i = 1; i <= inst->num_pins; i++){
202+
for (i = 1; i <= inst->num_pins; i++){
202203
if (*(inst->hal[i].bit)){
203204
*(inst->hal[0].en) = *(inst->hal[i].en);
204205
}

0 commit comments

Comments
 (0)