static int config_memory_open(git_config_backend *backend, git_config_level_t level, const git_repository *repo) { config_memory_backend *memory_backend = (config_memory_backend *) backend; config_memory_parse_data parse_data; git_config_parser reader; GIT_UNUSED(repo); if (memory_backend->cfg.size == 0) return 0; git_parse_ctx_init(&reader.ctx, memory_backend->cfg.ptr, memory_backend->cfg.size); reader.file = NULL; parse_data.entries = memory_backend->entries; parse_data.level = level; return git_config_parse(&reader, NULL, read_variable_cb, NULL, NULL, &parse_data); }
git_patch_parse_ctx *git_patch_parse_ctx_init( const char *content, size_t content_len, const git_patch_options *opts) { git_patch_parse_ctx *ctx; git_patch_options default_opts = GIT_PATCH_OPTIONS_INIT; if ((ctx = git__calloc(1, sizeof(git_patch_parse_ctx))) == NULL) return NULL; if ((git_parse_ctx_init(&ctx->parse_ctx, content, content_len)) < 0) { git__free(ctx); return NULL; } if (opts) memcpy(&ctx->opts, opts, sizeof(git_patch_options)); else memcpy(&ctx->opts, &default_opts, sizeof(git_patch_options)); GIT_REFCOUNT_INC(ctx); return ctx; }