comparison Meerwald/coord.c @ 8:f83ef905a63d

fixing many warnings increase capacity for coordinates in bruyn fix some uninit. variables
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Tue, 22 Apr 2008 13:36:05 +0200
parents be303a3f5ea8
children
comparison
equal deleted inserted replaced
7:2b350281f8b0 8:f83ef905a63d
3 #include "coord.h" 3 #include "coord.h"
4 4
5 struct coords *alloc_coords(int n) { 5 struct coords *alloc_coords(int n) {
6 struct coords *c; 6 struct coords *c;
7 7
8 if (c = malloc(sizeof(struct coords))) 8 if ((c = malloc(sizeof(struct coords))) != NULL)
9 init_coords(c, n); 9 init_coords(c, n);
10 #ifdef DEBUG 10 #ifdef DEBUG
11 else 11 else
12 fprintf(stderr, "alloc_coords(): malloc failed\n"); 12 fprintf(stderr, "alloc_coords(): malloc failed\n");
13 #endif 13 #endif
37 #endif 37 #endif
38 38
39 c->count = 0; 39 c->count = 0;
40 c->max = n; 40 c->max = n;
41 41
42 if (c->values = malloc(n * sizeof(struct coord))) 42 if ((c->values = malloc(n * sizeof(struct coord))) != NULL)
43 return 0; 43 return 0;
44 else 44 else
45 return -1; 45 return -1;
46 } 46 }
47 47

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.