projects
/
gnulib.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Better handling of collision with AIX stpncpy() function.
[gnulib.git]
/
lib
/
exclude.c
diff --git
a/lib/exclude.c
b/lib/exclude.c
index
ffe136f
..
3d1d3bf
100644
(file)
--- a/
lib/exclude.c
+++ b/
lib/exclude.c
@@
-33,15
+33,8
@@
extern int errno;
#endif
#include <stddef.h>
#include <stdio.h>
#endif
#include <stddef.h>
#include <stdio.h>
-#if HAVE_STDLIB_H
-# include <stdlib.h>
-#endif
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
+#include <stdlib.h>
+#include <string.h>
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
#if HAVE_INTTYPES_H
# include <inttypes.h>
#else
@@
-267,21
+260,25
@@
add_exclude_file (void (*add_func) (struct exclude *, char const *, int),
e = errno;
buf = xrealloc (buf, buf_count + 1);
e = errno;
buf = xrealloc (buf, buf_count + 1);
+ buf[buf_count] = line_end;
+ lim = buf + buf_count + ! (buf_count == 0 || buf[buf_count - 1] == line_end);
+ pattern = buf;
- for (p
attern = p = buf, lim = buf + buf_count; p <= lim;
p++)
- if (
p < lim ? *p == line_end : buf < p && p[-1]
)
+ for (p
= buf; p < lim;
p++)
+ if (
*p == line_end
)
{
{
+ char *pattern_end = p;
+
if (is_space (line_end))
{
if (is_space (line_end))
{
- char *pattern_end = p;
for (; ; pattern_end--)
if (pattern_end == pattern)
goto next_pattern;
else if (! is_space (pattern_end[-1]))
break;
for (; ; pattern_end--)
if (pattern_end == pattern)
goto next_pattern;
else if (! is_space (pattern_end[-1]))
break;
- *pattern_end = '\0';
}
}
+ *pattern_end = '\0';
(*add_func) (ex, pattern, options);
next_pattern:
(*add_func) (ex, pattern, options);
next_pattern: