diff options
author | Denis Kenzior <denis.kenzior@intel.com> | 2009-10-22 17:42:01 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-10-23 17:05:54 -0500 |
commit | cbaf0aacfca50f85654a3ff7f0ed973aa67f37f3 (patch) | |
tree | 747d56222dc115c482dc49904a4ac87bcd7c45b9 /src | |
parent | 6f7ef99759c5eb3a1372f6f2b5110bc7c5ab5988 (diff) | |
download | ofono-cbaf0aacfca50f85654a3ff7f0ed973aa67f37f3.tar.bz2 |
Refactor: context finding by path
Diffstat (limited to 'src')
-rw-r--r-- | src/gprs.c | 14 |
1 files changed, 3 insertions, 11 deletions
@@ -99,23 +99,15 @@ static inline const char *gprs_context_type_to_string(int type) return NULL; } -static struct context *gprs_context_by_path(struct ofono_gprs *gprs, +static struct pri_context *gprs_context_by_path(struct ofono_gprs *gprs, const char *ctx_path) { - const char *path = __ofono_atom_get_path(gprs->atom); GSList *l; - unsigned id; - - if (!g_str_has_prefix(ctx_path, path)) - return NULL; - - if (sscanf(ctx_path + strlen(path), "/primarycontext%2u", &id) != 1) - return NULL; for (l = gprs->contexts; l; l = l->next) { - struct context *ctx = l->data; + struct pri_context *ctx = l->data; - if (ctx->context->id == id) + if (g_str_equal(ctx_path, ctx->path)) return ctx; } |