Skip to content

Commit bda7904

Browse files
committed
Merge branch 'hv/config-from-blob' into maint
Compilation fix on platforms with fgetc() and friends defined as macros. * hv/config-from-blob: config: do not use C function names as struct members
2 parents b5699d1 + 49d6cfa commit bda7904

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

config.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ struct config_source {
2727
struct strbuf value;
2828
struct strbuf var;
2929

30-
int (*fgetc)(struct config_source *c);
31-
int (*ungetc)(int c, struct config_source *conf);
32-
long (*ftell)(struct config_source *c);
30+
int (*do_fgetc)(struct config_source *c);
31+
int (*do_ungetc)(int c, struct config_source *conf);
32+
long (*do_ftell)(struct config_source *c);
3333
};
3434

3535
static struct config_source *cf;
@@ -217,13 +217,13 @@ int git_config_from_parameters(config_fn_t fn, void *data)
217217

218218
static int get_next_char(void)
219219
{
220-
int c = cf->fgetc(cf);
220+
int c = cf->do_fgetc(cf);
221221

222222
if (c == '\r') {
223223
/* DOS like systems */
224-
c = cf->fgetc(cf);
224+
c = cf->do_fgetc(cf);
225225
if (c != '\n') {
226-
cf->ungetc(c, cf);
226+
cf->do_ungetc(c, cf);
227227
c = '\r';
228228
}
229229
}
@@ -992,9 +992,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)
992992
top.u.file = f;
993993
top.name = filename;
994994
top.die_on_error = 1;
995-
top.fgetc = config_file_fgetc;
996-
top.ungetc = config_file_ungetc;
997-
top.ftell = config_file_ftell;
995+
top.do_fgetc = config_file_fgetc;
996+
top.do_ungetc = config_file_ungetc;
997+
top.do_ftell = config_file_ftell;
998998

999999
ret = do_config_from(&top, fn, data);
10001000

@@ -1013,9 +1013,9 @@ int git_config_from_buf(config_fn_t fn, const char *name, const char *buf,
10131013
top.u.buf.pos = 0;
10141014
top.name = name;
10151015
top.die_on_error = 0;
1016-
top.fgetc = config_buf_fgetc;
1017-
top.ungetc = config_buf_ungetc;
1018-
top.ftell = config_buf_ftell;
1016+
top.do_fgetc = config_buf_fgetc;
1017+
top.do_ungetc = config_buf_ungetc;
1018+
top.do_ftell = config_buf_ftell;
10191019

10201020
return do_config_from(&top, fn, data);
10211021
}
@@ -1196,7 +1196,7 @@ static int store_aux(const char *key, const char *value, void *cb)
11961196
return 1;
11971197
}
11981198

1199-
store.offset[store.seen] = cf->ftell(cf);
1199+
store.offset[store.seen] = cf->do_ftell(cf);
12001200
store.seen++;
12011201
}
12021202
break;
@@ -1223,19 +1223,19 @@ static int store_aux(const char *key, const char *value, void *cb)
12231223
* Do not increment matches: this is no match, but we
12241224
* just made sure we are in the desired section.
12251225
*/
1226-
store.offset[store.seen] = cf->ftell(cf);
1226+
store.offset[store.seen] = cf->do_ftell(cf);
12271227
/* fallthru */
12281228
case SECTION_END_SEEN:
12291229
case START:
12301230
if (matches(key, value)) {
1231-
store.offset[store.seen] = cf->ftell(cf);
1231+
store.offset[store.seen] = cf->do_ftell(cf);
12321232
store.state = KEY_SEEN;
12331233
store.seen++;
12341234
} else {
12351235
if (strrchr(key, '.') - key == store.baselen &&
12361236
!strncmp(key, store.key, store.baselen)) {
12371237
store.state = SECTION_SEEN;
1238-
store.offset[store.seen] = cf->ftell(cf);
1238+
store.offset[store.seen] = cf->do_ftell(cf);
12391239
}
12401240
}
12411241
}

0 commit comments

Comments
 (0)