#include "cache.h"
#include "attr.h"
-#define ATTR__UNKNOWN ((void *) -2)
+const char git_attr__true[] = "(builtin)true";
+const char git_attr__false[] = "\0(builtin)false";
+static const char git_attr__unknown[] = "(builtin)unknown";
+#define ATTR__TRUE git_attr__true
+#define ATTR__FALSE git_attr__false
+#define ATTR__UNSET NULL
+#define ATTR__UNKNOWN git_attr__unknown
/*
* The basic design decision here is that we are not going to have
/* What does a matched pattern decide? */
struct attr_state {
struct git_attr *attr;
- void *setto;
+ const char *setto;
};
struct match_attr {
struct match_attr *a = e->attrs[i];
int j;
for (j = 0; j < a->num_attr; j++) {
- void *setto = a->state[j].setto;
+ const char *setto = a->state[j].setto;
if (setto == ATTR__TRUE ||
setto == ATTR__FALSE ||
setto == ATTR__UNSET ||
setto == ATTR__UNKNOWN)
;
else
- free(setto);
+ free((char*) setto);
}
free(a);
}
a = parse_attr_line(line, "[builtin]", ++lineno, 1);
if (!a)
continue;
- res->attrs = xrealloc(res->attrs, res->num_matches + 1);
+ res->attrs = xrealloc(res->attrs,
+ sizeof(struct match_attr *) * (res->num_matches + 1));
res->attrs[res->num_matches++] = a;
}
return res;
a = parse_attr_line(buf, path, ++lineno, macro_ok);
if (!a)
continue;
- res->attrs = xrealloc(res->attrs, res->num_matches + 1);
+ res->attrs = xrealloc(res->attrs,
+ sizeof(struct match_attr *) * (res->num_matches + 1));
res->attrs[res->num_matches++] = a;
}
fclose(fp);
for (i = 0; 0 < rem && i < a->num_attr; i++) {
struct git_attr *attr = a->state[i].attr;
- void **n = &(check[attr->attr_nr].value);
- void *v = a->state[i].setto;
+ const char **n = &(check[attr->attr_nr].value);
+ const char *v = a->state[i].setto;
if (*n == ATTR__UNKNOWN) {
debug_set(what, a->u.pattern, attr, v);
rem = macroexpand(stk, rem);
for (i = 0; i < num; i++) {
- void *value = check_all_attr[check[i].attr->attr_nr].value;
+ const char *value = check_all_attr[check[i].attr->attr_nr].value;
if (value == ATTR__UNKNOWN)
value = ATTR__UNSET;
check[i].value = value;