Esempio n. 1
0
File: mailmap.c Progetto: 0369/git
static void read_mailmap_string(struct string_list *map, char *buf,
				char **repo_abbrev)
{
	while (*buf) {
		char *end = strchrnul(buf, '\n');

		if (*end)
			*end++ = '\0';

		read_mailmap_line(map, buf, repo_abbrev);
		buf = end;
	}
}
Esempio n. 2
0
static void read_mailmap_buf(struct string_list *map,
			     const char *buf, unsigned long len,
			     char **repo_abbrev)
{
	while (len) {
		const char *end = strchrnul(buf, '\n');
		unsigned long linelen = end - buf + 1;
		char *line = xmemdupz(buf, linelen);

		read_mailmap_line(map, line, repo_abbrev);

		free(line);
		buf += linelen;
		len -= linelen;
	}
}
Esempio n. 3
0
File: mailmap.c Progetto: 0369/git
static int read_mailmap_file(struct string_list *map, const char *filename,
			     char **repo_abbrev)
{
	char buffer[1024];
	FILE *f;

	if (!filename)
		return 0;

	f = fopen(filename, "r");
	if (!f) {
		if (errno == ENOENT)
			return 0;
		return error("unable to open mailmap at %s: %s",
			     filename, strerror(errno));
	}

	while (fgets(buffer, sizeof(buffer), f) != NULL)
		read_mailmap_line(map, buffer, repo_abbrev);
	fclose(f);
	return 0;
}