Skip to content

Commit

Permalink
libvbr/vbr.c: modernize vbr_strlcpy() signature.
Browse files Browse the repository at this point in the history
The vbr_strlcpy() function declares that its arguments should live in
registers:

  vbr_strlcpy(dst, src, size)
        register char *dst;
        register const char *src;
        ssize_t size;
  {
    ...

This makes GCC unhappy when -Werror=strict-prototypes is used:

  vbr.c:167:1: error: function declaration isn't a prototype
  [-Werror=strict-prototypes]
    167 | vbr_strlcpy(dst, src, size)

The "register" keyword is largely obsolete on modern systems anyway,
since the compiler is better at determining how to move memory around
than the programmer is. So to appease GCC and simplify the code a bit,
the signature has been changed to,

  vbr_strlcpy(char *dst, const char *src, ssize_t size) { ... }

changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit.  # # On branch configure.ac-c-standard #
Your branch is up to date with 'origin/configure.ac-c-standard'.  # #
Changes to be committed: # modified: libvbr/vbr.c # # Changes not
staged for commit: # modified: configure # # Untracked files: #
0000-cover-letter.patch #
  • Loading branch information
orlitzky committed Feb 23, 2023
1 parent 2d6db02 commit 1f55173
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions libvbr/vbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,9 @@ static void vbr_error __P((VBR *, const char *, ...));
*/

size_t
vbr_strlcpy(dst, src, size)
register char *dst;
register const char *src;
ssize_t size;
vbr_strlcpy(char *dst, const char *src, ssize_t size)
{
register ssize_t i;
ssize_t i;

if (size-- <= 0)
return strlen(src);
Expand Down

0 comments on commit 1f55173

Please sign in to comment.