while(f) {
if (!fmt || exts_compare(f->exts, fmt)) {
char *stringp=NULL;
- exts = strdup(f->exts);
+ exts = ast_strdupa(f->exts);
/* Try each kind of extension */
stringp=exts;
ext = strsep(&stringp, "|");
}
ext = strsep(&stringp, "|");
} while(ext);
- free(exts);
+
}
f = f->next;
}
struct ast_format *f;
struct ast_filestream *fs=NULL;
char *fn;
- char *ext;
if (ast_mutex_lock(&formatlock)) {
ast_log(LOG_WARNING, "Unable to lock format list\n");
return NULL;
f = formats;
while(f) {
if (exts_compare(f->exts, type)) {
- char *stringp=NULL;
- /* XXX Implement check XXX */
- ext = strdup(f->exts);
- stringp=ext;
- ext = strsep(&stringp, "|");
- fn = build_filename(filename, ext);
+ fn = build_filename(filename, type);
fd = open(fn, flags | myflags);
if (fd >= 0) {
errno = 0;
} else if (errno != EEXIST)
ast_log(LOG_WARNING, "Unable to open file %s: %s\n", fn, strerror(errno));
free(fn);
- free(ext);
break;
}
f = f->next;
struct ast_format *f;
struct ast_filestream *fs=NULL;
char *fn,*orig_fn=NULL;
- char *ext;
char *buf=NULL;
size_t size = 0;
f = formats;
while(f) {
if (exts_compare(f->exts, type)) {
- char *stringp=NULL;
- /* XXX Implement check XXX */
- ext = ast_strdupa(f->exts);
- stringp=ext;
- ext = strsep(&stringp, "|");
- fn = build_filename(filename, ext);
+ fn = build_filename(filename, type);
fd = open(fn, flags | myflags, mode);
-
+
if (option_cache_record_files && fd >= 0) {
close(fd);
/*
fs->flags = flags;
fs->mode = mode;
if (option_cache_record_files) {
- fs->realfilename = build_filename(filename, ext);
+ fs->realfilename = build_filename(filename, type);
fs->filename = strdup(fn);
} else {
fs->realfilename = NULL;