MCPcopy Create free account
hub / github.com/awsm-research/LineVul / msg_cache_check

Function msg_cache_check

cppcheck/data/c_files/589.cpp:1–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1static int msg_cache_check(const char *id, struct BodyCache *bcache, void *data)
2{
3struct Context *ctx = (struct Context *) data;
4if (!ctx)
5return -1;
6struct PopData *pop_data = (struct PopData *) ctx->data;
7if (!pop_data)
8return -1;
9
10#ifdef USE_HCACHE
11/* keep hcache file if hcache == bcache */
12if (strcmp(HC_FNAME "." HC_FEXT, id) == 0)
13return 0;
14#endif
15
16for (int i = 0; i < ctx->msgcount; i++)
17{
18/* if the id we get is known for a header: done (i.e. keep in cache) */
19if (ctx->hdrs[i]->data && (mutt_str_strcmp(ctx->hdrs[i]->data, id) == 0))
20return 0;
21}
22
23/* message not found in context -> remove it from cache
24* return the result of bcache, so we stop upon its first error
25*/
26 return mutt_bcache_del(bcache, id);
27}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected