diff options
| author | Russell Belfer <arrbee@arrbee.com> | 2012-01-16 18:00:18 -0800 |
|---|---|---|
| committer | Russell Belfer <arrbee@arrbee.com> | 2012-01-16 18:00:18 -0800 |
| commit | 83bfbdf593a76c591bb9cbd40cec6fca36c81a9c (patch) | |
| tree | 2a6e6d9e3c2ba568fa749a2a483a0f9012d770ff /src/attr_file.c | |
| parent | a51cd8e6f6724079a552b75e014f792f3f68e158 (diff) | |
| download | libgit2-83bfbdf593a76c591bb9cbd40cec6fca36c81a9c.tar.gz | |
Remove poor git__removechar function
Going back over this, the git__removechar function was not
needed (only invoked once) and is actually mislabeled. As
implemented, it really only made sense for removing backslash
characters, since two of the "removed" characters in a row
would include the second one -- i.e. it really implements
stripping backslash-escaped strings where a backslash allows
internal whitespace in a word.
Diffstat (limited to 'src/attr_file.c')
| -rw-r--r-- | src/attr_file.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index f6eaad69d..4303c7667 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -363,8 +363,18 @@ int git_attr_fnmatch__parse( *base = git__next_line(pattern); return GIT_ENOMEM; } else { - /* remove '\' that might have be used for internal whitespace */ - spec->length = git__removechar(spec->pattern, '\\'); + /* strip '\' that might have be used for internal whitespace */ + char *to = spec->pattern; + for (scan = spec->pattern; *scan; to++, scan++) { + if (*scan == '\\') + scan++; /* skip '\' but include next char */ + if (to != scan) + *to = *scan; + } + if (to != scan) { + *to = '\0'; + spec->length = (to - spec->pattern); + } } return GIT_SUCCESS; |
