1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 08:47:56 +01:00
git/interpolate.h
Shawn O. Pearce 3a55602eec General const correctness fixes
We shouldn't attempt to assign constant strings into char*, as the
string is not writable at runtime.  Likewise we should always be
treating unsigned values as unsigned values, not as signed values.

Most of these are very straightforward.  The only exception is the
(unnecessary) xstrdup/free in builtin-branch.c for the detached
head case.  Since this is a user-level interactive type program
and that particular code path is executed no more than once, I feel
that the extra xstrdup call is well worth the easy elimination of
this warning.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-07 10:47:10 -08:00

26 lines
589 B
C

/*
* Copyright 2006 Jon Loeliger
*/
#ifndef INTERPOLATE_H
#define INTERPOLATE_H
/*
* Convert a NUL-terminated string in buffer orig,
* performing substitutions on %-named sub-strings from
* the interpretation table.
*/
struct interp {
const char *name;
char *value;
};
extern void interp_set_entry(struct interp *table, int slot, const char *value);
extern void interp_clear_table(struct interp *table, int ninterps);
extern int interpolate(char *result, int reslen,
const char *orig,
const struct interp *interps, int ninterps);
#endif /* INTERPOLATE_H */