config_file.h 1.41 KB
Newer Older
1
/*
Edward Thomson committed
2
 * Copyright (C) the libgit2 contributors. All rights reserved.
3 4 5 6 7 8 9 10 11
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_config_file_h__
#define INCLUDE_config_file_h__

#include "git2/config.h"

Ben Straub committed
12
GIT_INLINE(int) git_config_file_open(git_config_backend *cfg, unsigned int level)
13
{
14
	return cfg->open(cfg, level);
15 16
}

Ben Straub committed
17
GIT_INLINE(void) git_config_file_free(git_config_backend *cfg)
18 19 20 21
{
	cfg->free(cfg);
}

Russell Belfer committed
22
GIT_INLINE(int) git_config_file_get_string(
Ben Straub committed
23
	const git_config_entry **out, git_config_backend *cfg, const char *name)
Russell Belfer committed
24 25 26 27
{
	return cfg->get(cfg, name, out);
}

28
GIT_INLINE(int) git_config_file_set_string(
Ben Straub committed
29
	git_config_backend *cfg, const char *name, const char *value)
30 31 32 33
{
	return cfg->set(cfg, name, value);
}

Russell Belfer committed
34
GIT_INLINE(int) git_config_file_delete(
Ben Straub committed
35
	git_config_backend *cfg, const char *name)
Russell Belfer committed
36 37 38 39
{
	return cfg->del(cfg, name);
}

40
GIT_INLINE(int) git_config_file_foreach(
Ben Straub committed
41
	git_config_backend *cfg,
42
	int (*fn)(const git_config_entry *entry, void *data),
43 44
	void *data)
{
45
	return git_config_backend_foreach_match(cfg, NULL, fn, data);
46 47 48
}

GIT_INLINE(int) git_config_file_foreach_match(
Ben Straub committed
49
	git_config_backend *cfg,
50
	const char *regexp,
51
	int (*fn)(const git_config_entry *entry, void *data),
52 53
	void *data)
{
54
	return git_config_backend_foreach_match(cfg, regexp, fn, data);
55 56
}

57 58
extern int git_config_file_normalize_section(char *start, char *end);

59 60
#endif