diff options
author | Steve Murphy <murf@digium.com> | 2008-10-09 14:17:33 +0000 |
---|---|---|
committer | Steve Murphy <murf@digium.com> | 2008-10-09 14:17:33 +0000 |
commit | e235a073769eaf6e388bbe8d4eb5189db4018de6 (patch) | |
tree | 3c963213e39ade4edd8366a127b3d3fe9d74e360 /main | |
parent | f6c78aa0feb3e13fc8e7262a650ab4c8aa4babe2 (diff) |
(closes issue #13557)
Reported by: nickpeirson
Patches:
pbx.c.patch uploaded by nickpeirson (license 579)
replace_bzero+bcopy.patch uploaded by nickpeirson (license 579)
Tested by: nickpeirson, murf
1. replaced all refs to bzero and bcopy to memset and memmove instead.
2. added a note to the CODING-GUIDELINES
3. add two macros to asterisk.h to prevent bzero, bcopy from creeping
back into the source
4. removed bzero from configure, configure.ac, autoconfig.h.in
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@147807 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/astobj2.c | 2 | ||||
-rw-r--r-- | main/cli.c | 4 | ||||
-rw-r--r-- | main/config.c | 2 | ||||
-rw-r--r-- | main/pbx.c | 2 | ||||
-rw-r--r-- | main/rtp.c | 4 | ||||
-rw-r--r-- | main/translate.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/main/astobj2.c b/main/astobj2.c index b80c407d0..2e9070d6d 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -262,7 +262,7 @@ static int __ao2_ref(void *user_data, const int delta) /* for safety, zero-out the astobj2 header and also the * first word of the user-data, which we make sure is always * allocated. */ - bzero(obj, sizeof(struct astobj2 *) + sizeof(void *) ); + memset(obj, '\0', sizeof(struct astobj2 *) + sizeof(void *) ); free(obj); } diff --git a/main/cli.c b/main/cli.c index 784628226..0b8120617 100644 --- a/main/cli.c +++ b/main/cli.c @@ -1426,7 +1426,7 @@ static int __ast_cli_unregister(struct ast_cli_entry *e, struct ast_cli_entry *e e->_full_cmd = NULL; if (e->handler) { /* this is a new-style entry. Reset fields and free memory. */ - bzero((char **)(e->cmda), sizeof(e->cmda)); + memset((char **)(e->cmda), '\0', sizeof(e->cmda)); ast_free(e->command); e->command = NULL; e->usage = NULL; @@ -1444,7 +1444,7 @@ static int __ast_cli_register(struct ast_cli_entry *e, struct ast_cli_entry *ed) char **dst = (char **)e->cmda; /* need to cast as the entry is readonly */ char *s; - bzero (&a, sizeof(a)); + memset(&a, '\0', sizeof(a)); e->handler(e, CLI_INIT, &a); /* XXX check that usage and command are filled up */ s = ast_skip_blanks(e->command); diff --git a/main/config.c b/main/config.c index 870aaed57..5ea68a7a7 100644 --- a/main/config.c +++ b/main/config.c @@ -2340,7 +2340,7 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags, struct hostent *hp; struct ast_hostent ahp; - bzero(&_sa_buf, sizeof(_sa_buf)); /* clear buffer */ + memset(&_sa_buf, '\0', sizeof(_sa_buf)); /* clear buffer */ /* duplicate the string to strip away the :port */ port = ast_strdupa(arg); buf = strsep(&port, ":"); diff --git a/main/pbx.c b/main/pbx.c index 4fff74b10..c428b0843 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1728,7 +1728,7 @@ static int ext_cmp1(const char **p) return 0x40000; /* XXX make this entry go last... */ } - bzero(chars, sizeof(chars)); /* clear all chars in the set */ + memset(chars, '\0', sizeof(chars)); /* clear all chars in the set */ for (; *p < end ; (*p)++) { unsigned char c1, c2; /* first-last char in range */ c1 = (unsigned char)((*p)[0]); diff --git a/main/rtp.c b/main/rtp.c index a05603f22..82610484a 100644 --- a/main/rtp.c +++ b/main/rtp.c @@ -675,7 +675,7 @@ int ast_stun_request(int s, struct sockaddr_in *dst, res = ast_select(s + 1, &rfds, NULL, NULL, &to); if (res <= 0) /* timeout or error */ continue; - bzero(&src, sizeof(src)); + memset(&src, '\0', sizeof(src)); srclen = sizeof(src); /* XXX pass -1 in the size, because stun_handle_packet might * write past the end of the buffer. @@ -687,7 +687,7 @@ int ast_stun_request(int s, struct sockaddr_in *dst, retry, res); continue; } - bzero(answer, sizeof(struct sockaddr_in)); + memset(answer, '\0', sizeof(struct sockaddr_in)); stun_handle_packet(s, &src, reply_buf, res, stun_get_mapped, answer); res = 0; /* signal regular exit */ diff --git a/main/translate.c b/main/translate.c index 96d67bc92..dfd50fcc5 100644 --- a/main/translate.c +++ b/main/translate.c @@ -451,7 +451,7 @@ static void rebuild_matrix(int samples) ast_debug(1, "Resetting translation matrix\n"); - bzero(tr_matrix, sizeof(tr_matrix)); + memset(tr_matrix, '\0', sizeof(tr_matrix)); /* first, compute all direct costs */ AST_RWLIST_TRAVERSE(&translators, t, list) { |