MCPcopy Create free account
hub / github.com/git/git / parse_name_and_email

Function parse_name_and_email

mailmap.c:100–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static char *parse_name_and_email(char *buffer, char **name,
101 char **email, int allow_empty_email)
102{
103 char *left, *right, *nstart, *nend;
104 *name = *email = NULL;
105
106 if (!(left = strchr(buffer, '<')))
107 return NULL;
108 if (!(right = strchr(left + 1, '>')))
109 return NULL;
110 if (!allow_empty_email && (left+1 == right))
111 return NULL;
112
113 /* remove whitespace from beginning and end of name */
114 nstart = buffer;
115 while (isspace(*nstart) && nstart < left)
116 ++nstart;
117 nend = left-1;
118 while (nend > nstart && isspace(*nend))
119 --nend;
120
121 *name = (nstart <= nend ? nstart : NULL);
122 *email = left+1;
123 *(nend+1) = '\0';
124 *right++ = '\0';
125
126 return (*right == '\0' ? NULL : right);
127}
128
129static void read_mailmap_line(struct string_list *map, char *buffer)
130{

Callers 1

read_mailmap_lineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected