diff options
author | Denis Kenzior <denkenz@gmail.com> | 2010-05-26 15:13:04 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-05-26 21:03:14 -0500 |
commit | 53dc160362823493d4ba046db70466797fcf51eb (patch) | |
tree | 66a66dd0e9ae7917bc57e8e0028ebc3d76970f72 /src/modem.c | |
parent | d3b9f42ed4a6d365405140b8e89f93ef4488d5f9 (diff) | |
download | ofono-53dc160362823493d4ba046db70466797fcf51eb.tar.bz2 |
Refactor: The macros are no longer needed
Diffstat (limited to 'src/modem.c')
-rw-r--r-- | src/modem.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/src/modem.c b/src/modem.c index 3e43751c..54c7e9ba 100644 --- a/src/modem.c +++ b/src/modem.c @@ -268,14 +268,6 @@ gboolean __ofono_modem_remove_atom_watch(struct ofono_modem *modem, return __ofono_watchlist_remove_item(modem->atom_watches, id); } -#define FIND_ATOM_IN_LIST(list) \ - for (l = list; l; l = l->next) { \ - atom = l->data; \ - \ - if (atom->type == type) \ - return atom; \ - } \ - struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem, enum ofono_atom_type type) { @@ -285,21 +277,16 @@ struct ofono_atom *__ofono_modem_find_atom(struct ofono_modem *modem, if (modem == NULL) return NULL; - FIND_ATOM_IN_LIST(modem->atoms) + for (l = modem->atoms; l; l = l->next) { + atom = l->data; + + if (atom->type == type) + return atom; + } return NULL; } -#define FOREACH_ATOM_IN_LIST(list) \ - for (l = list; l; l = l->next) { \ - atom = l->data; \ - \ - if (atom->type != type) \ - continue; \ - \ - callback(atom, data); \ - } \ - void __ofono_modem_foreach_atom(struct ofono_modem *modem, enum ofono_atom_type type, ofono_atom_func callback, void *data) @@ -310,7 +297,14 @@ void __ofono_modem_foreach_atom(struct ofono_modem *modem, if (modem == NULL) return; - FOREACH_ATOM_IN_LIST(modem->atoms) + for (l = modem->atoms; l; l = l->next) { + atom = l->data; + + if (atom->type != type) + continue; + + callback(atom, data); + } } void __ofono_atom_free(struct ofono_atom *atom) |