[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r12421 - gnunet/src/vpn
From: |
gnunet |
Subject: |
[GNUnet-SVN] r12421 - gnunet/src/vpn |
Date: |
Sat, 31 Jul 2010 01:35:17 +0200 |
Author: toelke
Date: 2010-07-31 01:35:17 +0200 (Sat, 31 Jul 2010)
New Revision: 12421
Modified:
gnunet/src/vpn/gnunet-daemon-vpn.c
gnunet/src/vpn/gnunet-vpn-pretty-print.c
Log:
Streamline the memory-allocation
Modified: gnunet/src/vpn/gnunet-daemon-vpn.c
===================================================================
--- gnunet/src/vpn/gnunet-daemon-vpn.c 2010-07-30 23:35:05 UTC (rev 12420)
+++ gnunet/src/vpn/gnunet-daemon-vpn.c 2010-07-30 23:35:17 UTC (rev 12421)
@@ -174,7 +174,7 @@
GNUNET_GETOPT_OPTION_END
};
- struct vpn_cls* cls = (struct vpn_cls*)malloc(sizeof(struct vpn_cls));
+ struct vpn_cls* cls = GNUNET_malloc(sizeof(struct vpn_cls));
return (GNUNET_OK ==
GNUNET_PROGRAM_run (argc,
@@ -183,7 +183,7 @@
gettext_noop ("help text"),
options, &run, cls)) ? ret : 1;
- free(cls); // Make clang happy
+ GNUNET_free(cls); // Make clang happy
}
/* end of gnunet-daemon-vpn.c */
Modified: gnunet/src/vpn/gnunet-vpn-pretty-print.c
===================================================================
--- gnunet/src/vpn/gnunet-vpn-pretty-print.c 2010-07-30 23:35:05 UTC (rev
12420)
+++ gnunet/src/vpn/gnunet-vpn-pretty-print.c 2010-07-30 23:35:17 UTC (rev
12421)
@@ -109,7 +109,7 @@
}}}
void pkt_printf(struct ip6_pkt* pkt) {{{
- char* buf = (char*)malloc(strlen(pretty)+1);
+ char* buf = alloca(strlen(pretty)+1);
char tmp[9];
memcpy(buf, pretty, strlen(pretty)+1);
@@ -146,7 +146,6 @@
}
printf("%s", buf);
- free(buf);
}}}
void pkt_printf_ip6tcp(struct ip6_tcp* pkt) {{{
@@ -267,13 +266,13 @@
printf("\t#ns: %d\n", ntohs(pkt->data.nscount));
printf("\t#ar: %d\n", ntohs(pkt->data.arcount));
- struct dns_query** queries = (struct
dns_query**)malloc(qdcount*sizeof(struct dns_query*));
+ struct dns_query** queries = alloca(qdcount*sizeof(struct dns_query*));
unsigned int idx = 0;
int i;
for (i = 0; i < qdcount; i++) {
- queries[i] = (struct dns_query*)malloc(sizeof(struct
dns_query));
- queries[i]->name = (unsigned char*)malloc(255); // see RFC1035
+ queries[i] = alloca(sizeof(struct dns_query));
+ queries[i]->name = alloca(255); // see RFC1035
unsigned char* name = queries[i]->name;
int len = pkt->data.data[idx++];
while (len != 0) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r12421 - gnunet/src/vpn,
gnunet <=