diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-06-14 23:01:01 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-06-14 23:01:01 +0000 |
commit | b179e2155f886117b68499c5c918c82242728a86 (patch) | |
tree | ca14014e3c226332296ae0d687f996e9d8dfe6b2 /main | |
parent | 5dd9887ac7c638e8460f85ec2a93f5b490f15d6d (diff) |
Convert uses of strdup() to ast_strdup()
(issue #9983, eliel)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69436 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r-- | main/asterisk.c | 2 | ||||
-rw-r--r-- | main/channel.c | 2 | ||||
-rw-r--r-- | main/cli.c | 10 | ||||
-rw-r--r-- | main/enum.c | 4 | ||||
-rw-r--r-- | main/file.c | 8 | ||||
-rw-r--r-- | main/http.c | 8 | ||||
-rw-r--r-- | main/loader.c | 4 | ||||
-rw-r--r-- | main/pbx.c | 4 |
8 files changed, 21 insertions, 21 deletions
diff --git a/main/asterisk.c b/main/asterisk.c index 2e469729b..de0f4c14e 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1980,7 +1980,7 @@ static char **ast_el_strtoarr(char *buf) } } - match_list[matches++] = strdup(retstr); + match_list[matches++] = ast_strdup(retstr); } if (!match_list) diff --git a/main/channel.c b/main/channel.c index 86e4a92b9..1e3c3ec9a 100644 --- a/main/channel.c +++ b/main/channel.c @@ -295,7 +295,7 @@ static char *complete_channeltypes(const char *line, const char *word, int pos, AST_LIST_TRAVERSE(&backends, cl, list) { if (!strncasecmp(word, cl->tech->type, wordlen) && ++which > state) { - ret = strdup(cl->tech->type); + ret = ast_strdup(cl->tech->type); break; } } diff --git a/main/cli.c b/main/cli.c index fa30bf3e5..e2ddeb3c8 100644 --- a/main/cli.c +++ b/main/cli.c @@ -105,7 +105,7 @@ static char *complete_fn(const char *word, int state) if (c && word[0] != '/') c += (strlen(ast_config_AST_MODULE_DIR) + 1); - return c ? strdup(c) : c; + return c ? ast_strdup(c) : c; } static char *handle_load(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) @@ -693,7 +693,7 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str /* XXX remember to handle the optional "off" */ if (a->pos != e->args) return NULL; - return a->n == 0 ? strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args); + return a->n == 0 ? ast_strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args); } /* 'core set debug channel {all|chan_id}' */ if (a->argc == e->args + 2) { @@ -1027,7 +1027,7 @@ static int set_full_cmd(struct ast_cli_entry *e) char buf[80]; ast_join(buf, sizeof(buf), e->cmda); - e->_full_cmd = strdup(buf); + e->_full_cmd = ast_strdup(buf); if (!e->_full_cmd) { ast_log(LOG_WARNING, "-- cannot allocate <%s>\n", buf); return -1; @@ -1144,7 +1144,7 @@ static char *is_prefix(const char *word, const char *token, if (strncasecmp(token, word, lw)) /* no match */ return NULL; *actual = 1; - return (pos != 0) ? NULL : strdup(token); + return (pos != 0) ? NULL : ast_strdup(token); } /* now handle regexp match */ @@ -1158,7 +1158,7 @@ static char *is_prefix(const char *word, const char *token, continue; (*actual)++; if (pos-- == 0) - return strdup(s); + return ast_strdup(s); } return NULL; } diff --git a/main/enum.c b/main/enum.c index a54506045..1c9d34184 100644 --- a/main/enum.c +++ b/main/enum.c @@ -345,8 +345,8 @@ static int enum_callback(void *context, unsigned char *answer, int len, unsigned if ((p = ast_realloc(c->naptr_rrs, sizeof(*c->naptr_rrs) * (c->naptr_rrs_count + 1)))) { c->naptr_rrs = p; memcpy(&c->naptr_rrs[c->naptr_rrs_count].naptr, answer, sizeof(c->naptr_rrs->naptr)); - c->naptr_rrs[c->naptr_rrs_count].result = strdup(c->dst); - c->naptr_rrs[c->naptr_rrs_count].tech = strdup(c->tech); + c->naptr_rrs[c->naptr_rrs_count].result = ast_strdup(c->dst); + c->naptr_rrs[c->naptr_rrs_count].tech = ast_strdup(c->tech); c->naptr_rrs[c->naptr_rrs_count].sort_pos = c->naptr_rrs_count; c->naptr_rrs_count++; } diff --git a/main/file.c b/main/file.c index cd5e2e435..3c809e9c0 100644 --- a/main/file.c +++ b/main/file.c @@ -839,7 +839,7 @@ struct ast_filestream *ast_readfile(const char *filename, const char *type, cons fs->fmt = f; fs->flags = flags; fs->mode = mode; - fs->filename = strdup(filename); + fs->filename = ast_strdup(filename); fs->vfs = NULL; break; } @@ -950,11 +950,11 @@ struct ast_filestream *ast_writefile(const char *filename, const char *type, con fs->flags = flags; fs->mode = mode; if (orig_fn) { - fs->realfilename = strdup(orig_fn); - fs->filename = strdup(fn); + fs->realfilename = ast_strdup(orig_fn); + fs->filename = ast_strdup(fn); } else { fs->realfilename = NULL; - fs->filename = strdup(filename); + fs->filename = ast_strdup(filename); } fs->vfs = NULL; /* If truncated, we'll be at the beginning; if not truncated, then append */ diff --git a/main/http.c b/main/http.c index 2967298e7..c385c34c5 100644 --- a/main/http.c +++ b/main/http.c @@ -215,12 +215,12 @@ static struct ast_str *static_callback(struct sockaddr_in *req, const char *uri, out404: *status = 404; - *title = strdup("Not Found"); + *title = ast_strdup("Not Found"); return ast_http_error(404, "Not Found", NULL, "Nothing to see here. Move along."); out403: *status = 403; - *title = strdup("Access Denied"); + *title = ast_strdup("Access Denied"); return ast_http_error(403, "Access Denied", NULL, "Sorry, I cannot let you do that, Dave."); } @@ -616,7 +616,7 @@ static struct ast_str *handle_uri(struct sockaddr_in *sin, char *uri, int *statu out = ast_http_error(302, "Moved Temporarily", buf, "There is no spoon..."); *status = 302; - *title = strdup("Moved Temporarily"); + *title = ast_strdup("Moved Temporarily"); break; } } @@ -655,7 +655,7 @@ static struct ast_str *handle_uri(struct sockaddr_in *sin, char *uri, int *statu out = ast_http_error(404, "Not Found", NULL, "The requested URL was not found on this server."); *status = 404; - *title = strdup("Not Found"); + *title = ast_strdup("Not Found"); } cleanup: diff --git a/main/loader.c b/main/loader.c index 060243ccc..cd4e09ba4 100644 --- a/main/loader.c +++ b/main/loader.c @@ -526,7 +526,7 @@ char *ast_module_helper(const char *line, const char *word, int pos, int state, if (!strncasecmp(word, cur->resource, l) && (cur->info->reload || !needsreload) && ++which > state) { - ret = strdup(cur->resource); + ret = ast_strdup(cur->resource); break; } } @@ -535,7 +535,7 @@ char *ast_module_helper(const char *line, const char *word, int pos, int state, if (!ret) { for (i=0; !ret && reload_classes[i].name; i++) { if (!strncasecmp(word, reload_classes[i].name, l) && ++which > state) - ret = strdup(reload_classes[i].name); + ret = ast_strdup(reload_classes[i].name); } } diff --git a/main/pbx.c b/main/pbx.c index e01b7c9ad..74235f581 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1360,7 +1360,7 @@ static char *complete_show_function(const char *line, const char *word, int pos, AST_RWLIST_RDLOCK(&acf_root); AST_RWLIST_TRAVERSE(&acf_root, acf, acflist) { if (!strncasecmp(word, acf->name, wordlen) && ++which > state) { - ret = strdup(acf->name); + ret = ast_strdup(acf->name); break; } } @@ -3066,7 +3066,7 @@ static char *complete_show_application(const char *line, const char *word, int p AST_RWLIST_RDLOCK(&apps); AST_RWLIST_TRAVERSE(&apps, a, list) { if (!strncasecmp(word, a->name, wordlen) && ++which > state) { - ret = strdup(a->name); + ret = ast_strdup(a->name); break; } } |