Commit 8eb37cc0 8eb37cc0d563ee78a7b20389812edc4fb7c01fba by Sergey Poznyakoff

* include/mailutils/acl.h, include/mailutils/debug.hm4,

mailbox/acl.c (mu_sockaddr_to_str, mu_sockaddr_to_astr)
(mu_acl_check_sockaddr, mu_acl_check_inaddr): Use const pointers
when appropriate.
1 parent fdf9bec6
1 2008-01-16 Sergey Poznyakoff <gray@gnu.org.ua> 1 2008-01-16 Sergey Poznyakoff <gray@gnu.org.ua>
2 2
3 * include/mailutils/acl.h, include/mailutils/debug.hm4,
4 mailbox/acl.c (mu_sockaddr_to_str, mu_sockaddr_to_astr)
5 (mu_acl_check_sockaddr, mu_acl_check_inaddr): Use const pointers
6 when appropriate.
7
3 * include/mailutils/cfg.h (mu_offsetof): Move mu_offsetof to 8 * include/mailutils/cfg.h (mu_offsetof): Move mu_offsetof to
4 types.hin. 9 types.hin.
5 * include/mailutils/types.hin (mu_offsetof): New macro. 10 * include/mailutils/types.hin (mu_offsetof): New macro.
......
...@@ -58,9 +58,9 @@ int mu_acl_insert (mu_acl_t acl, size_t pos, int before, ...@@ -58,9 +58,9 @@ int mu_acl_insert (mu_acl_t acl, size_t pos, int before,
58 struct sockaddr *sa, int salen, unsigned long netmask); 58 struct sockaddr *sa, int salen, unsigned long netmask);
59 59
60 int mu_acl_check_ipv4 (mu_acl_t acl, unsigned int addr, mu_acl_result_t *pres); 60 int mu_acl_check_ipv4 (mu_acl_t acl, unsigned int addr, mu_acl_result_t *pres);
61 int mu_acl_check_inaddr (mu_acl_t acl, struct in_addr *inp, 61 int mu_acl_check_inaddr (mu_acl_t acl, const struct in_addr *inp,
62 mu_acl_result_t *pres); 62 mu_acl_result_t *pres);
63 int mu_acl_check_sockaddr (mu_acl_t acl, struct sockaddr *sa, int salen, 63 int mu_acl_check_sockaddr (mu_acl_t acl, const struct sockaddr *sa, int salen,
64 mu_acl_result_t *pres); 64 mu_acl_result_t *pres);
65 int mu_acl_check_fd (mu_acl_t acl, int fd, mu_acl_result_t *pres); 65 int mu_acl_check_fd (mu_acl_t acl, int fd, mu_acl_result_t *pres);
66 66
......
...@@ -94,10 +94,10 @@ int mu_debug_level_from_string (const char *string, mu_log_level_t *plev, ...@@ -94,10 +94,10 @@ int mu_debug_level_from_string (const char *string, mu_log_level_t *plev,
94 mu_debug_t debug); 94 mu_debug_t debug);
95 95
96 struct sockaddr; 96 struct sockaddr;
97 void mu_sockaddr_to_str (struct sockaddr *sa, int salen, 97 void mu_sockaddr_to_str (const struct sockaddr *sa, int salen,
98 char *bufptr, size_t buflen, 98 char *bufptr, size_t buflen,
99 size_t *plen); 99 size_t *plen);
100 char *mu_sockaddr_to_astr (struct sockaddr *sa, int salen); 100 char *mu_sockaddr_to_astr (const struct sockaddr *sa, int salen);
101 101
102 102
103 103
......
...@@ -364,7 +364,7 @@ mu_stpcpy (char **pbuf, size_t *psize, const char *src) ...@@ -364,7 +364,7 @@ mu_stpcpy (char **pbuf, size_t *psize, const char *src)
364 } 364 }
365 365
366 void 366 void
367 mu_sockaddr_to_str (struct sockaddr *sa, int salen, 367 mu_sockaddr_to_str (const struct sockaddr *sa, int salen,
368 char *bufptr, size_t buflen, 368 char *bufptr, size_t buflen,
369 size_t *plen) 369 size_t *plen)
370 { 370 {
...@@ -405,7 +405,7 @@ mu_sockaddr_to_str (struct sockaddr *sa, int salen, ...@@ -405,7 +405,7 @@ mu_sockaddr_to_str (struct sockaddr *sa, int salen,
405 } 405 }
406 406
407 char * 407 char *
408 mu_sockaddr_to_astr (struct sockaddr *sa, int salen) 408 mu_sockaddr_to_astr (const struct sockaddr *sa, int salen)
409 { 409 {
410 size_t size; 410 size_t size;
411 char *p; 411 char *p;
...@@ -700,7 +700,7 @@ _run_entry (void *item, void *data) ...@@ -700,7 +700,7 @@ _run_entry (void *item, void *data)
700 } 700 }
701 701
702 int 702 int
703 mu_acl_check_sockaddr (mu_acl_t acl, struct sockaddr *sa, int salen, 703 mu_acl_check_sockaddr (mu_acl_t acl, const struct sockaddr *sa, int salen,
704 mu_acl_result_t *pres) 704 mu_acl_result_t *pres)
705 { 705 {
706 struct run_closure r; 706 struct run_closure r;
...@@ -736,7 +736,8 @@ mu_acl_check_sockaddr (mu_acl_t acl, struct sockaddr *sa, int salen, ...@@ -736,7 +736,8 @@ mu_acl_check_sockaddr (mu_acl_t acl, struct sockaddr *sa, int salen,
736 } 736 }
737 737
738 int 738 int
739 mu_acl_check_inaddr (mu_acl_t acl, struct in_addr *inp, mu_acl_result_t *pres) 739 mu_acl_check_inaddr (mu_acl_t acl, const struct in_addr *inp,
740 mu_acl_result_t *pres)
740 { 741 {
741 struct sockaddr_in cs; 742 struct sockaddr_in cs;
742 int len = sizeof cs; 743 int len = sizeof cs;
......