Commit 91cd0f93 authored by Andreas Gustafsson's avatar Andreas Gustafsson

sizeof style

parent b414eb43
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dig.c,v 1.171 2001/11/22 01:59:01 gson Exp $ */
/* $Id: dig.c,v 1.172 2001/11/27 01:55:12 gson Exp $ */
#include <config.h>
#include <stdlib.h>
......@@ -546,7 +546,7 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) {
strlen(lookup->cmdline) - 1;
strncat(lookup->cmdline, "\n", remaining);
if (first) {
snprintf(append, sizeof (append),
snprintf(append, sizeof(append),
";; global options: %s %s\n",
short_form ? "short_form" : "",
printcmd ? "printcmd" : "");
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: compress_test.c,v 1.25 2001/11/27 00:55:39 gson Exp $ */
/* $Id: compress_test.c,v 1.26 2001/11/27 01:55:13 gson Exp $ */
#include <config.h>
......@@ -72,42 +72,42 @@ main(int argc, char *argv[]) {
dns_name_init(&name1, NULL);
region.base = plain1;
region.length = sizeof plain1;
region.length = sizeof(plain1);
dns_name_fromregion(&name1, &region);
dns_name_init(&name2, NULL);
region.base = plain2;
region.length = sizeof plain2;
region.length = sizeof(plain2);
dns_name_fromregion(&name2, &region);
dns_name_init(&name3, NULL);
region.base = plain3;
region.length = sizeof plain3;
region.length = sizeof(plain3);
dns_name_fromregion(&name3, &region);
test(DNS_COMPRESS_NONE, &name1, &name2, &name3, plain, sizeof plain);
test(DNS_COMPRESS_NONE, &name1, &name2, &name3, plain, sizeof(plain));
test(DNS_COMPRESS_GLOBAL14, &name1, &name2, &name3, plain,
sizeof plain);
test(DNS_COMPRESS_ALL, &name1, &name2, &name3, plain, sizeof plain);
sizeof(plain));
test(DNS_COMPRESS_ALL, &name1, &name2, &name3, plain, sizeof(plain));
dns_name_init(&name1, NULL);
region.base = bit1;
region.length = sizeof bit1;
region.length = sizeof(bit1);
dns_name_fromregion(&name1, &region);
dns_name_init(&name2, NULL);
region.base = bit2;
region.length = sizeof bit2;
region.length = sizeof(bit2);
dns_name_fromregion(&name2, &region);
dns_name_init(&name3, NULL);
region.base = bit3;
region.length = sizeof bit3;
region.length = sizeof(bit3);
dns_name_fromregion(&name3, &region);
test(DNS_COMPRESS_NONE, &name1, &name2, &name3, bit, sizeof bit);
test(DNS_COMPRESS_GLOBAL14, &name1, &name2, &name3, bit, sizeof bit);
test(DNS_COMPRESS_ALL, &name1, &name2, &name3, bit, sizeof bit);
test(DNS_COMPRESS_NONE, &name1, &name2, &name3, bit, sizeof(bit));
test(DNS_COMPRESS_GLOBAL14, &name1, &name2, &name3, bit, sizeof(bit));
test(DNS_COMPRESS_ALL, &name1, &name2, &name3, bit, sizeof(bit));
return (0);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db_test.c,v 1.56 2001/01/09 21:40:57 bwelling Exp $ */
/* $Id: db_test.c,v 1.57 2001/11/27 01:55:15 gson Exp $ */
/*
* Principal Author: Bob Halley
......@@ -248,7 +248,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
dbinfo *dbi;
unsigned int i;
dbi = isc_mem_get(mctx, sizeof *dbi);
dbi = isc_mem_get(mctx, sizeof(*dbi));
if (dbi == NULL)
return (ISC_R_NOMEMORY);
......@@ -281,7 +281,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
dns_rdataclass_in,
0, NULL, &dbi->db);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, dbi, sizeof *dbi);
isc_mem_put(mctx, dbi, sizeof(*dbi));
return (result);
}
......@@ -289,7 +289,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
result = dns_db_load(dbi->db, filename);
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
dns_db_detach(&dbi->db);
isc_mem_put(mctx, dbi, sizeof *dbi);
isc_mem_put(mctx, dbi, sizeof(*dbi));
return (result);
}
printf("loaded\n");
......@@ -301,7 +301,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
} else {
if (dns_dbtable_add(dbtable, dbi->db) != ISC_R_SUCCESS) {
dns_db_detach(&dbi->db);
isc_mem_put(mctx, dbi, sizeof *dbi);
isc_mem_put(mctx, dbi, sizeof(*dbi));
return (result);
}
}
......@@ -325,7 +325,7 @@ unload_all(void) {
}
dns_db_detach(&dbi->db);
ISC_LIST_UNLINK(dbs, dbi, link);
isc_mem_put(mctx, dbi, sizeof *dbi);
isc_mem_put(mctx, dbi, sizeof(*dbi));
}
}
......@@ -472,7 +472,7 @@ main(int argc, char *argv[]) {
while (!done) {
if (!quiet)
printf("\n");
if (fgets(s, sizeof s, stdin) == NULL) {
if (fgets(s, sizeof(s), stdin) == NULL) {
done = ISC_TRUE;
continue;
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy_test.c,v 1.17 2001/11/27 00:55:41 gson Exp $ */
/* $Id: entropy_test.c,v 1.18 2001/11/27 01:55:16 gson Exp $ */
#include <config.h>
......@@ -108,10 +108,10 @@ main(int argc, char **argv) {
flags = 0;
flags |= ISC_ENTROPY_GOODONLY;
flags |= ISC_ENTROPY_BLOCKING;
result = isc_entropy_getdata(ent, buffer, sizeof buffer, &returned,
result = isc_entropy_getdata(ent, buffer, sizeof(buffer), &returned,
flags);
CHECK("good data only, blocking mode", result);
hex_dump("blocking mode data", buffer, sizeof buffer);
hex_dump("blocking mode data", buffer, sizeof(buffer));
{
isc_entropy_t *entcopy1 = NULL;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gxba_test.c,v 1.7 2001/01/09 21:41:05 bwelling Exp $ */
/* $Id: gxba_test.c,v 1.8 2001/11/27 01:55:17 gson Exp $ */
#include <config.h>
......@@ -46,7 +46,7 @@ print_he(struct hostent *he, int error, const char *fun, const char *name) {
i = 1;
while (*c != NULL) {
char buf[128];
inet_ntop(he->h_addrtype, *c, buf, sizeof (buf));
inet_ntop(he->h_addrtype, *c, buf, sizeof(buf));
printf("\taddress[%d] = %s\n", i, buf);
c++;
i++;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: gxbn_test.c,v 1.10 2001/01/09 21:41:06 bwelling Exp $ */
/* $Id: gxbn_test.c,v 1.11 2001/11/27 01:55:18 gson Exp $ */
#include <config.h>
......@@ -46,7 +46,7 @@ print_he(struct hostent *he, int error, const char *fun, const char *name) {
i = 1;
while (*c != NULL) {
char buf[128];
inet_ntop(he->h_addrtype, *c, buf, sizeof (buf));
inet_ntop(he->h_addrtype, *c, buf, sizeof(buf));
printf("\taddress[%d] = %s\n", i, buf);
c++;
i++;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: name_test.c,v 1.33 2001/01/09 21:41:20 bwelling Exp $ */
/* $Id: name_test.c,v 1.34 2001/11/27 01:55:19 gson Exp $ */
#include <config.h>
......@@ -166,7 +166,7 @@ main(int argc, char *argv[]) {
dns_fixedname_init(&wname);
name = dns_fixedname_name(&wname);
dns_fixedname_init(&wname2);
while (fgets(s, sizeof s, stdin) != NULL) {
while (fgets(s, sizeof(s), stdin) != NULL) {
len = strlen(s);
if (len > 0 && s[len - 1] == '\n') {
s[len - 1] = '\0';
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nxtify.c,v 1.19 2001/01/09 21:41:26 bwelling Exp $ */
/* $Id: nxtify.c,v 1.20 2001/11/27 01:55:20 gson Exp $ */
#include <config.h>
......@@ -184,7 +184,7 @@ nxtify(char *filename) {
*/
dns_db_closeversion(db, &wversion, ISC_TRUE);
len = strlen(filename);
if (len + 4 + 1 > sizeof newfilename)
if (len + 4 + 1 > sizeof(newfilename))
fatal("filename too long");
sprintf(newfilename, "%s.new", filename);
result = dns_db_dump(db, NULL, newfilename);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rdata_test.c,v 1.36 2001/11/27 00:55:46 gson Exp $ */
/* $Id: rdata_test.c,v 1.37 2001/11/27 01:55:21 gson Exp $ */
#include <config.h>
......@@ -836,7 +836,7 @@ main(int argc, char *argv[]) {
}
}
memset(&dctx, '0', sizeof dctx);
memset(&dctx, '0', sizeof(dctx));
dctx.allowed = DNS_COMPRESS_ALL;
RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: serial_test.c,v 1.10 2001/01/09 21:41:37 bwelling Exp $ */
/* $Id: serial_test.c,v 1.11 2001/11/27 01:55:22 gson Exp $ */
#include <config.h>
......@@ -30,8 +30,8 @@ main() {
char buf[1024];
char *s, *e;
while (fgets(buf, sizeof buf, stdin) != NULL) {
buf[sizeof buf - 1] = '\0';
while (fgets(buf, sizeof(buf), stdin) != NULL) {
buf[sizeof(buf) - 1] = '\0';
s = buf;
a = strtoul(s, &e, 0);
if (s == e)
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: shutdown_test.c,v 1.18 2001/01/09 21:41:38 bwelling Exp $ */
/* $Id: shutdown_test.c,v 1.19 2001/11/27 01:55:23 gson Exp $ */
#include <config.h>
......@@ -79,7 +79,7 @@ shutdown_action(isc_task_t *task, isc_event_t *event) {
isc_timer_detach(&info->timer);
nevent = isc_event_allocate(info->mctx, info, T2_SHUTDOWNOK,
t2_shutdown, &tasks[1],
sizeof *event);
sizeof(*event));
RUNTIME_CHECK(nevent != NULL);
info->exiting = ISC_TRUE;
isc_task_sendanddetach(&info->peer, &nevent);
......@@ -94,8 +94,7 @@ foo_event(isc_task_t *task, isc_event_t *event) {
}
static void
tick(isc_task_t *task, isc_event_t *event)
{
tick(isc_task_t *task, isc_event_t *event) {
t_info *info = event->ev_arg;
isc_event_t *nevent;
......@@ -113,7 +112,7 @@ tick(isc_task_t *task, isc_event_t *event)
nevent = isc_event_allocate(info->mctx, info,
T2_SHUTDOWNDONE,
t1_shutdown, &tasks[0],
sizeof *event);
sizeof(*event));
RUNTIME_CHECK(nevent != NULL);
isc_task_send(info->peer, &nevent);
isc_task_detach(&info->peer);
......@@ -123,7 +122,7 @@ tick(isc_task_t *task, isc_event_t *event)
nevent = isc_event_allocate(info->mctx, info,
FOO_EVENT,
foo_event, task,
sizeof *event);
sizeof(*event));
RUNTIME_CHECK(nevent != NULL);
isc_task_sendanddetach(&task, &nevent);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sig0_test.c,v 1.9 2001/03/28 02:43:44 bwelling Exp $ */
/* $Id: sig0_test.c,v 1.10 2001/11/27 01:55:24 gson Exp $ */
#include <config.h>
......@@ -155,7 +155,7 @@ buildquery(void) {
CHECK("dns_message_gettempname", result);
isc_buffer_init(&namesrc, nametext, strlen(nametext));
isc_buffer_add(&namesrc, strlen(nametext));
isc_buffer_init(&namedst, namedata, sizeof namedata);
isc_buffer_init(&namedst, namedata, sizeof(namedata));
dns_name_init(qname, NULL);
result = dns_name_fromtext(qname, &namesrc, dns_rootname, ISC_FALSE,
&namedst);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sock_test.c,v 1.47 2001/01/09 21:41:41 bwelling Exp $ */
/* $Id: sock_test.c,v 1.48 2001/11/27 01:55:26 gson Exp $ */
#include <config.h>
......@@ -82,12 +82,12 @@ my_recv(isc_task_t *task, isc_event_t *event) {
dev->n, dev->result);
if (dev->address.type.sa.sa_family == AF_INET6) {
inet_ntop(AF_INET6, &dev->address.type.sin6.sin6_addr,
host, sizeof (host));
host, sizeof(host));
printf("\tFrom: %s port %d\n", host,
ntohs(dev->address.type.sin6.sin6_port));
} else {
inet_ntop(AF_INET, &dev->address.type.sin.sin_addr,
host, sizeof (host));
host, sizeof(host));
printf("\tFrom: %s port %d\n", host,
ntohs(dev->address.type.sin.sin_port));
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sym_test.c,v 1.22 2001/01/09 21:41:42 bwelling Exp $ */
/* $Id: sym_test.c,v 1.23 2001/11/27 01:55:27 gson Exp $ */
#include <config.h>
......@@ -71,7 +71,7 @@ main(int argc, char *argv[]) {
RUNTIME_CHECK(isc_symtab_create(mctx, 691, undefine_action, NULL,
case_sensitive, &st) == ISC_R_SUCCESS);
while (fgets(s, sizeof s, stdin) != NULL) {
while (fgets(s, sizeof(s), stdin) != NULL) {
len = strlen(s);
if (len > 0 && s[len - 1] == '\n') {
s[len - 1] = '\0';
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: task_test.c,v 1.47 2001/01/09 21:41:44 bwelling Exp $ */
/* $Id: task_test.c,v 1.48 2001/11/27 01:55:28 gson Exp $ */
#include <config.h>
......@@ -122,49 +122,49 @@ main(int argc, char *argv[]) {
* program.
*/
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "1",
sizeof *event);
sizeof(*event));
isc_task_send(t1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "2",
sizeof *event);
sizeof(*event));
isc_task_send(t2, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "3",
sizeof *event);
sizeof(*event));
isc_task_send(t3, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "4",
sizeof *event);
sizeof(*event));
isc_task_send(t4, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "2",
sizeof *event);
sizeof(*event));
isc_task_send(t2, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "3",
sizeof *event);
sizeof(*event));
isc_task_send(t3, &event);
event = isc_event_allocate(mctx, (void *)1, 1, my_callback, "4",
sizeof *event);
sizeof(*event));
isc_task_send(t4, &event);
isc_task_purgerange(t3,
NULL,
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_tasks.c,v 1.29 2001/08/08 22:54:33 gson Exp $ */
/* $Id: t_tasks.c,v 1.30 2001/11/27 01:55:31 gson Exp $ */
#include <config.h>
......@@ -216,7 +216,7 @@ t_tasks1(void) {
* program.
*/
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -225,7 +225,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -234,7 +234,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -243,7 +243,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -252,7 +252,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -261,7 +261,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -270,7 +270,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -279,7 +279,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -288,7 +288,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "1",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -297,7 +297,7 @@ t_tasks1(void) {
isc_task_send(task1, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "2",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -306,7 +306,7 @@ t_tasks1(void) {
isc_task_send(task2, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "3",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -315,7 +315,7 @@ t_tasks1(void) {
isc_task_send(task3, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "4",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -324,7 +324,7 @@ t_tasks1(void) {
isc_task_send(task4, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "2",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -333,7 +333,7 @@ t_tasks1(void) {
isc_task_send(task2, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "3",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -342,7 +342,7 @@ t_tasks1(void) {
isc_task_send(task3, &event);
event = isc_event_allocate(mctx, (void *)1, 1, t1_callback, "4",
sizeof *event);
sizeof(*event));
if (event == NULL) {
t_info("isc_event_allocate failed\n");
return(T_UNRESOLVED);
......@@ -532,7 +532,7 @@ t_tasks2(void) {