diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-03-19 04:09:55 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-03-19 04:09:55 +0000 |
commit | f1d2a11aade12a7bd15e7dc21c754d2de7efc9d0 (patch) | |
tree | 43b25c38b5efa38293024cf12441db7818095eb4 /main/http.c | |
parent | c1cf92d304a43e217d1ae11b7f7e4cab4a91156e (diff) |
Minor change to use Asterisk macros
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@109841 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/http.c')
-rw-r--r-- | main/http.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/main/http.c b/main/http.c index c3df5af42..c0212d242 100644 --- a/main/http.c +++ b/main/http.c @@ -136,13 +136,16 @@ static AST_RWLIST_HEAD_STATIC(uri_redirects, http_uri_redirect); static const char *ftype2mtype(const char *ftype, char *wkspace, int wkspacelen) { int x; + if (ftype) { - for (x=0;x<sizeof(mimetypes) / sizeof(mimetypes[0]); x++) { + for (x = 0; x < ARRAY_LEN(mimetypes); x++) { if (!strcasecmp(ftype, mimetypes[x].ext)) return mimetypes[x].mtype; } } - snprintf(wkspace, wkspacelen, "text/%s", ftype ? ftype : "plain"); + + snprintf(wkspace, wkspacelen, "text/%s", S_OR(ftype, "plain")); + return wkspace; } |