Mercurial > MadButterfly
comparison src/timer.c @ 822:586e50f82c1f
Unify coding style tag for emacs and vim.
author | Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com> |
---|---|
date | Tue, 14 Sep 2010 01:08:39 +0800 |
parents | 530bb7728546 |
children | 7ccc094bdbe5 |
comparison
equal
deleted
inserted
replaced
821:bfdc82bbd6e4 | 822:586e50f82c1f |
---|---|
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- | |
2 // vim: sw=4:ts=8:sts=4 | |
1 #include <stdio.h> | 3 #include <stdio.h> |
2 #include <stdint.h> | 4 #include <stdint.h> |
3 #include <stdlib.h> | 5 #include <stdlib.h> |
4 #include <string.h> | 6 #include <string.h> |
5 #include "mb_timer.h" | 7 #include "mb_timer.h" |
21 elmpool_t *timer_pool; | 23 elmpool_t *timer_pool; |
22 }; | 24 }; |
23 | 25 |
24 mb_tman_t *mb_tman_new(void) { | 26 mb_tman_t *mb_tman_new(void) { |
25 mb_tman_t *tman; | 27 mb_tman_t *tman; |
26 | 28 |
27 tman = (mb_tman_t *)malloc(sizeof(mb_tman_t)); | 29 tman = (mb_tman_t *)malloc(sizeof(mb_tman_t)); |
28 if(tman == NULL) | 30 if(tman == NULL) |
29 return NULL; | 31 return NULL; |
30 | 32 |
31 tman->timer_pool = elmpool_new(sizeof(mb_timer_t), 32); | 33 tman->timer_pool = elmpool_new(sizeof(mb_timer_t), 32); |
74 else | 76 else |
75 STAILQ_INS_AFTER(mb_timer_t, next, timer, last); | 77 STAILQ_INS_AFTER(mb_timer_t, next, timer, last); |
76 | 78 |
77 return timer; | 79 return timer; |
78 } | 80 } |
79 | 81 |
80 int mb_tman_remove(mb_tman_t *tman, mb_timer_t *timer) { | 82 int mb_tman_remove(mb_tman_t *tman, mb_timer_t *timer) { |
81 STAILQ_REMOVE(tman->timers, mb_timer_t, next, timer); | 83 STAILQ_REMOVE(tman->timers, mb_timer_t, next, timer); |
82 elmpool_elm_free(tman->timer_pool, timer); | 84 elmpool_elm_free(tman->timer_pool, timer); |
83 | 85 |
84 return OK; | 86 return OK; |