mirror of
https://github.com/git/git.git
synced 2024-12-14 12:23:35 +08:00
ef90d6d420
git_config() only had a function parameter, but no callback data parameter. This assumes that all callback functions only modify global variables. With this patch, every callback gets a void * parameter, and it is hoped that this will help the libification effort. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
24 lines
439 B
C
24 lines
439 B
C
#include "cache.h"
|
|
|
|
static const char *alias_key;
|
|
static char *alias_val;
|
|
|
|
static int alias_lookup_cb(const char *k, const char *v, void *cb)
|
|
{
|
|
if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
|
|
if (!v)
|
|
return config_error_nonbool(k);
|
|
alias_val = xstrdup(v);
|
|
return 0;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
char *alias_lookup(const char *alias)
|
|
{
|
|
alias_key = alias;
|
|
alias_val = NULL;
|
|
git_config(alias_lookup_cb, NULL);
|
|
return alias_val;
|
|
}
|