Revision 0ef9c7ee xseg/peers/user/timer.c

b/xseg/peers/user/timer.c
49 49
#define SEC 1000000000 //1sec = 10^9 nsec
50 50
#define SEC2 (uint64_t) SEC*SEC //1sec*1sec = 10^18 nsec^2
51 51

  
52
int init_timer(struct timer *tm, int insanity)
52
int init_timer(struct timer **tm, int insanity)
53 53
{
54
	tm = malloc(sizeof(struct timer));
55
	if (!tm) {
54
	*tm = malloc(sizeof(struct timer));
55
	if (!*tm) {
56 56
		perror("malloc");
57 57
		return -1;
58 58
	}
59 59

  
60
	memset(tm, 0, sizeof(struct timer));
61
	tm->insanity = insanity;
60
	memset(*tm, 0, sizeof(struct timer));
61
	(*tm)->insanity = insanity;
62 62
	return 0;
63 63
}
64 64

  

Also available in: Unified diff