From ec6e6939dd16e36da38a75731b51ab4a96c3b30f Mon Sep 17 00:00:00 2001 From: Thadeu Lima de Souza Cascardo Date: Sun, 12 Oct 2008 17:11:39 -0300 Subject: [PATCH] Added frontend requests mapping --- atom/ctx.c | 18 ++++++++++++++++++ include/atompub/map.h | 1 + 2 files changed, 19 insertions(+) diff --git a/atom/ctx.c b/atom/ctx.c index 8519b31..678509b 100644 --- a/atom/ctx.c +++ b/atom/ctx.c @@ -28,6 +28,7 @@ struct _atom_ctx AtomBackend *backend; AtomFrontend *frontend; GHashTable *bemap; + GHashTable *femap; }; AtomCtx * @@ -41,6 +42,8 @@ atom_ctx_new () ctx->frontend = NULL; ctx->bemap = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); + ctx->femap = g_hash_table_new_full (g_str_hash, g_str_equal, + g_free, g_free); return ctx; } @@ -55,6 +58,8 @@ atom_ctx_delete (AtomCtx *ctx) atom_frontend_delete (ctx->frontend); if (ctx->bemap) g_hash_table_destroy (ctx->bemap); + if (ctx->femap) + g_hash_table_destroy (ctx->femap); g_slice_free (AtomCtx, ctx); } @@ -120,3 +125,16 @@ atom_map_backend_requests (AtomCtx *ctx, char **reqs, g_hash_table_replace (ctx->bemap, key, val); } } + +void +atom_map_frontend_requests (AtomCtx *ctx, char **reqs, + AtomEntry **entries, size_t len) +{ + int i; + for (i = 0; i < len; i++) + { + char *key = g_strdup (reqs[i]); + char *val = g_strdup (atom_entry_id (entries[i])); + g_hash_table_replace (ctx->femap, key, val); + } +} diff --git a/include/atompub/map.h b/include/atompub/map.h index 06e180f..1be9525 100644 --- a/include/atompub/map.h +++ b/include/atompub/map.h @@ -24,5 +24,6 @@ #include void atom_map_backend_requests (AtomCtx *, char **, AtomEntry **, size_t); +void atom_map_frontend_requests (AtomCtx *, char **, AtomEntry **, size_t); #endif -- 2.20.1