my hg working dir managed to break itself somehow... my attempt to fix that, and add some cache code :)
/*
* On-disk structs
*/
#pragma pack(push)
#pragma pack(1)
struct cache_nest_header {
u_int32_t next_offset;
};
int _cache_nest_assign_op (struct cache *ctx, struct cache_op *op_info, struct cache_nest **nest_info) {
for (int i = 0; i < CACHE_NEST_COUNT; i++) {
if (ctx->nests[i].op == NULL) {
// found an unused nest
ctx->nests[i].op = op_info;
*nest_info = ctx->nests[i].op;
return 0;
}
}
// no unused nests
return -1;
}