* libnetfilter_log: misc annotations
@ 2010-12-18 20:17 Jan Engelhardt
2010-12-18 20:17 ` [PATCH 1/3] libipulog: rebuild required header file inclusion Jan Engelhardt
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jan Engelhardt @ 2010-12-18 20:17 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
The following changes since commit f4def3676c707e119c26457c4df176dbf54cedab:
Merge branch 'master' of git://dev.medozas.de/libnetfilter_log (2010-11-07 20:50:05 +0100)
are available in the git repository at:
git://dev.medozas.de/libnetfilter_log master
Jan Engelhardt (3):
libipulog: rebuild required header file inclusion
src: remove redundant casts
src: declare non-modified data as const
include/libnetfilter_log/libipulog.h | 11 +++++++----
src/libipulog_compat.c | 9 +++++----
utils/ulog_test.c | 2 +-
3 files changed, 13 insertions(+), 9 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] libipulog: rebuild required header file inclusion
2010-12-18 20:17 libnetfilter_log: misc annotations Jan Engelhardt
@ 2010-12-18 20:17 ` Jan Engelhardt
2010-12-21 19:46 ` Pablo Neira Ayuso
2010-12-18 20:17 ` [PATCH 2/3] src: remove redundant casts Jan Engelhardt
2010-12-18 20:17 ` [PATCH 3/3] src: declare non-modified data as const Jan Engelhardt
2 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2010-12-18 20:17 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
Use C++ headers for C++ and throw out #includes that are not needed
for the header file.
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
include/libnetfilter_log/libipulog.h | 9 ++++++---
src/libipulog_compat.c | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/include/libnetfilter_log/libipulog.h b/include/libnetfilter_log/libipulog.h
index 0278862..bb6736a 100644
--- a/include/libnetfilter_log/libipulog.h
+++ b/include/libnetfilter_log/libipulog.h
@@ -1,9 +1,12 @@
#ifndef _LIBIPULOG_H
#define _LIBIPULOG_H
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
+#ifdef __cplusplus
+# include <cstdint>
+#else
+# include <stdint.h>
+#endif
+#include <sys/types.h>
/* FIXME: glibc sucks */
#ifndef MSG_TRUNC
diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c
index 9d93bcd..8c90cdb 100644
--- a/src/libipulog_compat.c
+++ b/src/libipulog_compat.c
@@ -1,3 +1,4 @@
+#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] src: remove redundant casts
2010-12-18 20:17 libnetfilter_log: misc annotations Jan Engelhardt
2010-12-18 20:17 ` [PATCH 1/3] libipulog: rebuild required header file inclusion Jan Engelhardt
@ 2010-12-18 20:17 ` Jan Engelhardt
2010-12-21 19:56 ` Pablo Neira Ayuso
2010-12-18 20:17 ` [PATCH 3/3] src: declare non-modified data as const Jan Engelhardt
2 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2010-12-18 20:17 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
src/libipulog_compat.c | 2 +-
utils/ulog_test.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c
index 8c90cdb..a25cde9 100644
--- a/src/libipulog_compat.c
+++ b/src/libipulog_compat.c
@@ -91,7 +91,7 @@ struct ipulog_handle *ipulog_create_handle(u_int32_t gmask,
struct ipulog_handle *h;
unsigned int group = gmask2group(gmask);
- h = (struct ipulog_handle *) malloc(sizeof(*h)+PAYLOAD_SIZE);
+ h = malloc(sizeof(*h)+PAYLOAD_SIZE);
if (! h) {
ipulog_errno = IPULOG_ERR_HANDLE;
return NULL;
diff --git a/utils/ulog_test.c b/utils/ulog_test.c
index 142846b..d568aa4 100644
--- a/utils/ulog_test.c
+++ b/utils/ulog_test.c
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
}
/* allocate a receive buffer */
- buf = (unsigned char *) malloc(MYBUFSIZ);
+ buf = malloc(MYBUFSIZ);
if (!buf)
exit(1);
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] src: declare non-modified data as const
2010-12-18 20:17 libnetfilter_log: misc annotations Jan Engelhardt
2010-12-18 20:17 ` [PATCH 1/3] libipulog: rebuild required header file inclusion Jan Engelhardt
2010-12-18 20:17 ` [PATCH 2/3] src: remove redundant casts Jan Engelhardt
@ 2010-12-18 20:17 ` Jan Engelhardt
2010-12-21 19:56 ` Pablo Neira Ayuso
2 siblings, 1 reply; 7+ messages in thread
From: Jan Engelhardt @ 2010-12-18 20:17 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
---
include/libnetfilter_log/libipulog.h | 2 +-
src/libipulog_compat.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/libnetfilter_log/libipulog.h b/include/libnetfilter_log/libipulog.h
index bb6736a..6917ee7 100644
--- a/include/libnetfilter_log/libipulog.h
+++ b/include/libnetfilter_log/libipulog.h
@@ -48,7 +48,7 @@ ulog_packet_msg_t *ipulog_get_packet(struct ipulog_handle *h,
const unsigned char *buf,
size_t len);
-char *ipulog_strerror(int errcode);
+const char *ipulog_strerror(int errcode);
void ipulog_perror(const char *s);
diff --git a/src/libipulog_compat.c b/src/libipulog_compat.c
index a25cde9..6703c99 100644
--- a/src/libipulog_compat.c
+++ b/src/libipulog_compat.c
@@ -28,10 +28,10 @@ struct ipulog_handle
struct ulog_packet_msg upmsg; /* has to be last in structure */
};
-struct ipulog_errmap_t
+static const struct ipulog_errmap_t
{
int errcode;
- char *message;
+ const char *message;
} ipulog_errmap[] =
{
{ IPULOG_ERR_NONE, "No error" },
@@ -65,7 +65,7 @@ static unsigned int gmask2group(unsigned int gmask)
int ipulog_errno = IPULOG_ERR_NONE;
-char *ipulog_strerror(int errcode)
+const char *ipulog_strerror(int errcode)
{
if (errcode < 0 || errcode > IPULOG_MAXERR)
errcode = IPULOG_ERR_IMPL;
--
1.7.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] libipulog: rebuild required header file inclusion
2010-12-18 20:17 ` [PATCH 1/3] libipulog: rebuild required header file inclusion Jan Engelhardt
@ 2010-12-21 19:46 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2010-12-21 19:46 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 18/12/10 21:17, Jan Engelhardt wrote:
> Use C++ headers for C++ and throw out #includes that are not needed
> for the header file.
>
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> ---
> include/libnetfilter_log/libipulog.h | 9 ++++++---
> src/libipulog_compat.c | 1 +
> 2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/include/libnetfilter_log/libipulog.h b/include/libnetfilter_log/libipulog.h
> index 0278862..bb6736a 100644
> --- a/include/libnetfilter_log/libipulog.h
> +++ b/include/libnetfilter_log/libipulog.h
> @@ -1,9 +1,12 @@
> #ifndef _LIBIPULOG_H
> #define _LIBIPULOG_H
>
> -#include <errno.h>
> -#include <unistd.h>
> -#include <fcntl.h>
> +#ifdef __cplusplus
> +# include <cstdint>
> +#else
> +# include <stdint.h>
> +#endif
> +#include <sys/types.h>
I agree that these headers shouldn't be there but I'm worry about
breaking the compilation of existing applications that, for whatever
reason, rely on these includes.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/3] src: remove redundant casts
2010-12-18 20:17 ` [PATCH 2/3] src: remove redundant casts Jan Engelhardt
@ 2010-12-21 19:56 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2010-12-21 19:56 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 18/12/10 21:17, Jan Engelhardt wrote:
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> ---
> src/libipulog_compat.c | 2 +-
> utils/ulog_test.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
I have cherry-picked this one and pushed out to git.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] src: declare non-modified data as const
2010-12-18 20:17 ` [PATCH 3/3] src: declare non-modified data as const Jan Engelhardt
@ 2010-12-21 19:56 ` Pablo Neira Ayuso
0 siblings, 0 replies; 7+ messages in thread
From: Pablo Neira Ayuso @ 2010-12-21 19:56 UTC (permalink / raw)
To: Jan Engelhardt; +Cc: netfilter-devel
On 18/12/10 21:17, Jan Engelhardt wrote:
> Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
> ---
> include/libnetfilter_log/libipulog.h | 2 +-
> src/libipulog_compat.c | 6 +++---
> 2 files changed, 4 insertions(+), 4 deletions(-)
this one also applied, thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-12-21 19:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-18 20:17 libnetfilter_log: misc annotations Jan Engelhardt
2010-12-18 20:17 ` [PATCH 1/3] libipulog: rebuild required header file inclusion Jan Engelhardt
2010-12-21 19:46 ` Pablo Neira Ayuso
2010-12-18 20:17 ` [PATCH 2/3] src: remove redundant casts Jan Engelhardt
2010-12-21 19:56 ` Pablo Neira Ayuso
2010-12-18 20:17 ` [PATCH 3/3] src: declare non-modified data as const Jan Engelhardt
2010-12-21 19:56 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).