* Skip p_value leading components from "line"; as we do not accept * absolute paths, return NULL in that case. */
| 1156 | * absolute paths, return NULL in that case. |
| 1157 | */ |
| 1158 | static const char *skip_tree_prefix(int p_value, |
| 1159 | const char *line, |
| 1160 | int llen) |
| 1161 | { |
| 1162 | int nslash; |
| 1163 | int i; |
| 1164 | |
| 1165 | if (!p_value) |
| 1166 | return (llen && line[0] == '/') ? NULL : line; |
| 1167 | |
| 1168 | nslash = p_value; |
| 1169 | for (i = 0; i < llen; i++) { |
| 1170 | int ch = line[i]; |
| 1171 | if (ch == '/' && --nslash <= 0) |
| 1172 | return (i == 0) ? NULL : &line[i + 1]; |
| 1173 | } |
| 1174 | return NULL; |
| 1175 | } |
| 1176 | |
| 1177 | /* |
| 1178 | * This is to extract the same name that appears on "diff --git" |