diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-25 17:16:17 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-25 17:16:17 +0000 |
commit | 1663b44fbc3fbebdf597397f45fcaa033d00d032 (patch) | |
tree | 52587dda61ba1d8c8c05fa09307194f5a895d6fa /inet | |
parent | 6bcb494a99389d8c9b5846f8fe32dd9e791f94f7 (diff) | |
download | glibc-1663b44fbc3fbebdf597397f45fcaa033d00d032.zip glibc-1663b44fbc3fbebdf597397f45fcaa033d00d032.tar.gz glibc-1663b44fbc3fbebdf597397f45fcaa033d00d032.tar.bz2 |
* nis/nis_addmember.c (nis_addmember): Avoid unnecessary copying.
Avoid memory leak in case realloc fails. Simplification for
better code generation.
Avoid deprecation warning because of libc_hidden_proto for
inet6_option_alloc.
* inet/inet6_option.c (option_alloc): Renamed from
inet6_option_alloc. Made static.
(inet6_option_alloc): New a simple wrapper around option_alloc.
(inet6_option_append): Call option_alloc.
* include/netinet/in.h: Remove libc_hidden_proto for
inet6_option_alloc.
Diffstat (limited to 'inet')
-rw-r--r-- | inet/inet6_option.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/inet/inet6_option.c b/inet/inet6_option.c index f88982e..cae9ae5 100644 --- a/inet/inet6_option.c +++ b/inet/inet6_option.c @@ -75,6 +75,10 @@ get_opt_end (const uint8_t **result, const uint8_t *startp, } +static uint8_t *option_alloc (struct cmsghdr *cmsg, int datalen, int multx, + int plusy); + + /* RFC 2292, 6.3.1 This function returns the number of bytes required to hold an option @@ -150,7 +154,7 @@ inet6_option_append (cmsg, typep, multx, plusy) int len = typep[0] == IP6OPT_PAD1 ? 1 : typep[1] + 2; /* Get the pointer to the space in the message. */ - uint8_t *ptr = inet6_option_alloc (cmsg, len, multx, plusy); + uint8_t *ptr = option_alloc (cmsg, len, multx, plusy); if (ptr == NULL) /* Some problem with the parameters. */ return -1; @@ -169,12 +173,8 @@ inet6_option_append (cmsg, typep, multx, plusy) inet6_option_init(). This function returns a pointer to the 8-bit option type field that starts the option on success, or NULL on an error. */ -uint8_t * -inet6_option_alloc (cmsg, datalen, multx, plusy) - struct cmsghdr *cmsg; - int datalen; - int multx; - int plusy; +static uint8_t * +option_alloc (struct cmsghdr *cmsg, int datalen, int multx, int plusy) { /* The RFC limits the value of the alignment values. */ if ((multx != 1 && multx != 2 && multx != 4 && multx != 8) @@ -214,7 +214,17 @@ inet6_option_alloc (cmsg, datalen, multx, plusy) return result; } -libc_hidden_def (inet6_option_alloc) + + +uint8_t * +inet6_option_alloc (cmsg, datalen, multx, plusy) + struct cmsghdr *cmsg; + int datalen; + int multx; + int plusy; +{ + return option_alloc (cmsg, datalen, multx, plusy); +} /* RFC 2292, 6.3.5 |