mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-21 18:23:03 +00:00
style: avoid strncpy
syntax-check seems to dislike strncpy. The GNU Coreutils replaced their uses of strncpy with stpncpy. strlcpy is not an option. http://sources.redhat.com/ml/libc-alpha/2002-01/msg00159.html http://sources.redhat.com/ml/libc-alpha/2002-01/msg00011.html http://lists.gnu.org/archive/html/bug-gnulib/2004-09/msg00181.html * src/glyphs.c: Use stpncpy.
This commit is contained in:
1
lib/.gitignore
vendored
1
lib/.gitignore
vendored
@@ -313,6 +313,7 @@
|
|||||||
/stdlib.h
|
/stdlib.h
|
||||||
/stdlib.in.h
|
/stdlib.in.h
|
||||||
/stpcpy.c
|
/stpcpy.c
|
||||||
|
/stpncpy.c
|
||||||
/strchrnul.c
|
/strchrnul.c
|
||||||
/strchrnul.valgrind
|
/strchrnul.valgrind
|
||||||
/strdup.c
|
/strdup.c
|
||||||
|
|||||||
1
m4/.gitignore
vendored
1
m4/.gitignore
vendored
@@ -175,6 +175,7 @@
|
|||||||
/stdio_h.m4
|
/stdio_h.m4
|
||||||
/stdlib_h.m4
|
/stdlib_h.m4
|
||||||
/stpcpy.m4
|
/stpcpy.m4
|
||||||
|
/stpncpy.m4
|
||||||
/strchrnul.m4
|
/strchrnul.m4
|
||||||
/strdup.m4
|
/strdup.m4
|
||||||
/strerror.m4
|
/strerror.m4
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ static long
|
|||||||
on_success (const char *buf, size_t buflen, void *callback_arg)
|
on_success (const char *buf, size_t buflen, void *callback_arg)
|
||||||
{
|
{
|
||||||
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
||||||
assert (buflen < sizeof arg->buf);
|
assert (buflen + 1 < sizeof arg->buf);
|
||||||
strncpy (arg->buf, buf, buflen);
|
*stpncpy (arg->buf, buf, buflen) = '\0';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ on_failure (unsigned code MAYBE_UNUSED, const char *msg MAYBE_UNUSED,
|
|||||||
void *callback_arg)
|
void *callback_arg)
|
||||||
{
|
{
|
||||||
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
callback_arg_t *arg = (callback_arg_t *) callback_arg;
|
||||||
assert (strlen (arg->fallback) < sizeof arg->buf);
|
assert (strlen (arg->fallback) + 1 < sizeof arg->buf);
|
||||||
strcpy (arg->buf, arg->fallback);
|
strcpy (arg->buf, arg->fallback);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user