summaryrefslogtreecommitdiffstats
path: root/lib/libc/tests/nss/getproto_test.c
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2017-05-31 08:32:05 +0000
committerngie <ngie@FreeBSD.org>2017-05-31 08:32:05 +0000
commit81703ad4d4bd0fe4b1afca24b6a34ee91da0ec6d (patch)
treebf885f10b199c725185aa66bbf1371c74fb97e9f /lib/libc/tests/nss/getproto_test.c
parentebde5e121d6228ad0236e234d952228d9651156e (diff)
downloadFreeBSD-src-81703ad4d4bd0fe4b1afca24b6a34ee91da0ec6d.zip
FreeBSD-src-81703ad4d4bd0fe4b1afca24b6a34ee91da0ec6d.tar.gz
MFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037,r319038,r319039,r319040,r319041,r319042,r319043,r319044,r319045,r319046:
r319027: lib/libc/tests/nss: use calloc appropriately The pattern used prior to this commit was `calloc(1, n * sizeof(type))`; the pattern that should be used however is `calloc(n, sizeof(type))`. r319028: Sort make variables to suit style.Makefile(5) This is being done prior to functional changes. r319029: Staticize functions and remove unused variables to aid with bumping WARNS r319030: Fix -Wsign-compare warnings r319031: getusershell_test: staticize run_tests(..) to fix warnings r319033: getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings r319034: getaddrinfo_test: fix -Wsign-compare warnings r319035: getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319036: getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319037: getaddrinfo_test: mark unused function parameters __unused to fix -Wunused warnings r319038: getusershell_test: mark mdata parameter in compare_usershell __unused r319039: getserv_test: mark unused parameters __unused to fix corresponding warnings r319040: getrpc_test: fix -Wunused warnings - Mark unused function parameters unused. - Remove an unused function prototype. r319041: getproto_test: fix -Wunused warnings Mark unused parameters __unused in functions. r319042: gethostby_test: fix multiple warning types - Fix -Wmissing-declaration warning by staticizing run_tests. - Fix -Wsign-compare warnings by casting size_t types to int for comparisons. Reindent some of the code in sdump_hostent(..) to accomodate the overall changes. r319043: getpw_test: fix -Wunused warnings - Mark unused parameters __unused. - Put dump_passwd under DEBUG as it's only used in that case. r319044: getgr_test: fix -Wunused warnings r319045: Fix -Wunused and -Wshadow warnings r319046: Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0
Diffstat (limited to 'lib/libc/tests/nss/getproto_test.c')
-rw-r--r--lib/libc/tests/nss/getproto_test.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/libc/tests/nss/getproto_test.c b/lib/libc/tests/nss/getproto_test.c
index 5ae8555..5e2bec5 100644
--- a/lib/libc/tests/nss/getproto_test.c
+++ b/lib/libc/tests/nss/getproto_test.c
@@ -99,7 +99,7 @@ clone_protoent(struct protoent *dest, struct protoent const *src)
for (cp = src->p_aliases; *cp; ++cp)
++aliases_num;
- dest->p_aliases = calloc(1, (aliases_num+1) * sizeof(char *));
+ dest->p_aliases = calloc(aliases_num + 1, sizeof(char *));
assert(dest->p_aliases != NULL);
for (cp = src->p_aliases; *cp; ++cp) {
@@ -172,16 +172,16 @@ sdump_protoent(struct protoent *pe, char *buffer, size_t buflen)
written = snprintf(buffer, buflen, "%s %d",
pe->p_name, pe->p_proto);
buffer += written;
- if (written > buflen)
+ if (written > (int)buflen)
return;
buflen -= written;
if (pe->p_aliases != NULL) {
if (*(pe->p_aliases) != '\0') {
for (cp = pe->p_aliases; *cp; ++cp) {
- written = snprintf(buffer, buflen, " %s",*cp);
+ written = snprintf(buffer, buflen, " %s", *cp);
buffer += written;
- if (written > buflen)
+ if (written > (int)buflen)
return;
buflen -= written;
@@ -288,7 +288,7 @@ protoent_fill_test_data(struct protoent_test_data *td)
}
static int
-protoent_test_correctness(struct protoent *pe, void *mdata)
+protoent_test_correctness(struct protoent *pe, void *mdata __unused)
{
printf("testing correctness with the following data:\n");
dump_protoent(pe);
@@ -388,14 +388,14 @@ protoent_test_getprotobynumber(struct protoent *pe_model, void *mdata)
}
static int
-protoent_test_getprotoent(struct protoent *pe, void *mdata)
+protoent_test_getprotoent(struct protoent *pe, void *mdata __unused)
{
/* Only correctness can be checked when doing 1-pass test for
* getprotoent(). */
return (protoent_test_correctness(pe, NULL));
}
-int
+static int
run_tests(const char *snapshot_file, enum test_methods method)
{
struct protoent_test_data td, td_snap, td_2pass;
OpenPOWER on IntegriCloud