]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - inet/inet6_option.c
Prefer https to http for gnu.org and fsf.org URLs
[thirdparty/glibc.git] / inet / inet6_option.c
index f8000a16c7a7e7bde14e963bcaa41ee39958e540..643ea3d3d0437b9401fee395cf74b0f6d9be4f9c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003-2013 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2003.
 
@@ -14,7 +14,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
+   <https://www.gnu.org/licenses/>.  */
 
 #include <assert.h>
 #include <string.h>
@@ -24,7 +24,6 @@
 
 
 static void
-internal_function
 add_pad (struct cmsghdr *cmsg, int len)
 {
   unsigned char *p = CMSG_DATA (cmsg) + cmsg->cmsg_len - CMSG_LEN (0);
@@ -88,8 +87,7 @@ static uint8_t *option_alloc (struct cmsghdr *cmsg, int datalen, int multx,
    beginning (the value y in the alignment term "xn + y"), the type
    byte, the length byte, and the option data.  */
 int
-inet6_option_space (nbytes)
-     int nbytes;
+inet6_option_space (int nbytes)
 {
   /* Add room for the extension header.  */
   nbytes += sizeof (struct ip6_ext);
@@ -106,10 +104,7 @@ link_warning (inet6_option_space,
    contain either Hop-by-Hop or Destination options.  It returns 0 on
    success or -1 on an error.  */
 int
-inet6_option_init (bp, cmsgp, type)
-     void *bp;
-     struct cmsghdr **cmsgp;
-     int type;
+inet6_option_init (void *bp, struct cmsghdr **cmsgp, int type)
 {
   /* Only Hop-by-Hop or Destination options allowed.  */
   if (type != IPV6_HOPOPTS && type != IPV6_DSTOPTS)
@@ -143,11 +138,8 @@ link_warning (inet6_option_init,
    inet6_option_init().  This function returns 0 if it succeeds or -1 on
    an error.  */
 int
-inet6_option_append (cmsg, typep, multx, plusy)
-     struct cmsghdr *cmsg;
-     const uint8_t *typep;
-     int multx;
-     int plusy;
+inet6_option_append (struct cmsghdr *cmsg, const uint8_t *typep, int multx,
+                    int plusy)
 {
   /* typep is a pointer to the 8-bit option type.  It is assumed that this
      field is immediately followed by the 8-bit option data length field,
@@ -190,7 +182,7 @@ option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
   int dsize = cmsg->cmsg_len - CMSG_LEN (0);
 
   /* The first two bytes of the option are for the extended header.  */
-  if (__builtin_expect (dsize == 0, 0))
+  if (__glibc_unlikely (dsize == 0))
     {
       cmsg->cmsg_len += sizeof (struct ip6_ext);
       dsize = sizeof (struct ip6_ext);
@@ -223,11 +215,7 @@ option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
 
 
 uint8_t *
-inet6_option_alloc (cmsg, datalen, multx, plusy)
-     struct cmsghdr *cmsg;
-     int datalen;
-     int multx;
-     int plusy;
+inet6_option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy)
 {
   return option_alloc (cmsg, datalen, multx, plusy);
 }
@@ -245,9 +233,7 @@ link_warning (inet6_option_alloc,
    to be processed, the return value is -1 and *tptrp is NULL.  If an
    error occurs, the return value is -1 and *tptrp is not NULL.  */
 int
-inet6_option_next (cmsg, tptrp)
-     const struct cmsghdr *cmsg;
-     uint8_t **tptrp;
+inet6_option_next (const struct cmsghdr *cmsg, uint8_t **tptrp)
 {
   /* Make sure it is an option of the right type.  */
   if (cmsg->cmsg_level != IPPROTO_IPV6
@@ -303,10 +289,7 @@ link_warning (inet6_option_next,
    pointer to cmsghdr structure of which cmsg_level equals IPPROTO_IPV6
    and cmsg_type equals either IPV6_HOPOPTS or IPV6_DSTOPTS.  */
 int
-inet6_option_find (cmsg, tptrp, type)
-     const struct cmsghdr *cmsg;
-     uint8_t **tptrp;
-     int type;
+inet6_option_find (const struct cmsghdr *cmsg, uint8_t **tptrp, int type)
 {
   /* Make sure it is an option of the right type.  */
   if (cmsg->cmsg_level != IPPROTO_IPV6